UIScrollViewのタッチイベントを親クラスで受け取るために、UIScrollViewのカスタムクラスを作り、
|
[java] -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (!self.dragging) { [self.nextResponder touchesEnded: touches withEvent:event]; } [super touchesEnded: touches withEvent: event]; } [/java] |
のように、touchesEnded:をオーバーライドする方法が紹介されている。
http://d.hatena.ne.jp/spitfire_tree/20100707/1278470269 http://i.studio23c.com/?p=159
が、iOS5では、どうも親クラスにイベントがこない。どーしたもんかと、いろいろ調べてみたら
http://stackoverflow.com/questions/8485853/ios-5-uiscrollview-not-pass-touches-to-nextresponder
をみつけた。
|
[java] [self.nextResponder touchesEnded: touches withEvent:event]; [/java] |
を
|
[java] [[self.nextResponder nextResponder] touchesMoved:touches withEvent:event]; [/java] |
とすればよいとのこと。結構な時間をついやしてしまた。。。
Post Views: 265
Twitter : @dinagon
Instagram : @d_dinagon
フォロバします!!最近、ESP/Arduinoいじりすぎでアプリ開発が進んでない。歯医者なのに歯のことはあまり触れませんw