- (void)viewDidLoad { UITapGestureRecognizer *doubleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapGesture:)]; doubleFingerTap.numberOfTapsRequired = 2; doubleFingerTap.delegate = self; [self.webView addGestureRecognizer:doubleFingerTap]; [doubleFingerTap release]; }
и
#pragma mark Gesture recognizer delegate - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { return YES; }
так-же и сам метод, который будет вызываться при двойном тапе:
- (void) handleDoubleTapGesture:(UITapGestureRecognizer *) gestureRecognizer { if (gestureRecognizer.state == UIGestureRecognizerStateEnded) { ... } }
Ну и на последок, в *.h-файл нашего класса, добавляем описание поддержки протокола
<UIGestureRecognizerDelegate>