Chen Lu Chen Lu - 5 months ago 17
iOS Question

How to differentiate single tap gesture and double tap gesture?

I add both single and double tap gestures to one

UIImageView
, then the problem is every time I tried to double tap, it executed single tap's
UITapGestureRecognizer
first.

How can I get rid of this problem?

Answer

You maybe need requireGestureRecognizerToFail: method. Something like this:

[singleTapRecognizer requireGestureRecognizerToFail:doubleTapRecognizer];