次のメソッドが実装されたカスタムscrollViewがあります。
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//if not dragging send it on up the chain
if(!self.dragging){
[self.nextResponder touchesEnded:touches withEvent:event];
}else {
[super touchesEnded:touches withEvent:event];
}
}
そして、My View Controllerには、次の方法があります。
-(void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event {
NSLog(@"TOUCH");
//---get all touches on the screen---
NSSet *allTouches = [event allTouches];
//---compare the number of touches on the screen---
switch ([allTouches count])
{
//---single touch---
case 1: {
//---get info of the touch---
UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
//---compare the touches---
switch ([touch tapCount])
{
//---single tap---
case 1: {
NSLog(@"Single");
[self mySingleTapMethod];
} break;
//---double tap---
case 2: {
[self myDoubleTapMethod];
} break;
}
} break;
}
}
iOS 4では、これは完全に機能し、scrollviewのタッチが認識され、touchesEndedがビューコントローラーで呼び出され、すべてが正しく機能します。ただし、iOS 5xでは、touchesEndedが起動されることはありません。一体何が起こっているのか/間違っているのか誰かが知っていますか?