Reputation: 1922
In one of my app's UIViewControllers
, I have a double tap UIGestureRecognizer
where when the user double taps the screen, the app will start, pause, or resume the process of flashing words on the screen for a user to speed read an article. I also have a button that allows the user to go back one sentence, but the user can only do it when the user double taps to pause the reader.
However, if the user taps the button to go back one sentence twice very fast, the double tap is recognized and the app executes the blinking of words again.
I have the following code in my viewDidLoad
:
UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTapRecognizer setNumberOfTapsRequired:2];
[doubleTapRecognizer setDelaysTouchesEnded:NO];
[self.view addGestureRecognizer:doubleTapRecognizer];
Is there any way to make this button immune to the double tap UIGestureRecognizer
?
Upvotes: 0
Views: 58
Reputation: 212
doubleTapRecognizer.delegate = self;
Return NO from gestureRecognizerShouldBegin: in case button is tapped.
Upvotes: 2