Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple taps with UITapGestureRecognizer

I have attached 3 tap gesture recognizers to the same view - single, double and triple tap. However, a double tap results in the single and double tap selector being called and the same for a triple tap. I expected that UITapGestureRecognizer class would have handled this situation appropriately. Does multiple tap gestures require additional code? Thank you

like image 468
RunLoop Avatar asked May 14 '10 12:05

RunLoop


People also ask

How to add double tap gesture in iOS?

Go to Settings > Accessibility > Touch > Back Tap. Choose Double Tap or Triple Tap, then choose an action. To perform the action you set, double-tap or triple-tap the back of iPhone.

What is UITapGestureRecognizer?

A discrete gesture recognizer that interprets single or multiple taps. iOS 3.2+ iPadOS 3.2+ Mac Catalyst 13.1+ tvOS 9.0+


1 Answers

I ended up using only a single tap and a double tap. To get this to work properly, the following line should be added to the single gesture recognizer:

[singleTapGR requireGestureRecognizerToFail:doubleTapGR];
like image 130
RunLoop Avatar answered Sep 25 '22 06:09

RunLoop