iOS - Multiple Tap gesture recognizers

后端 未结 2 1034
梦毁少年i
梦毁少年i 2021-01-05 12:34

In my application, i\'ve to detect single, double and triple taps. So, I\'m using UITapGestureRecognizer. I\'m using the following code:

    UITapGestureReco         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 13:04

    Check with this,

    [oneTap requireGestureRecognizerToFail:doubleTap];
    [oneTap requireGestureRecognizerToFail:tripleTap];
    [doubleTap requireGestureRecognizerToFail:tripleTap];
    

    You had switched the taps in the methods and you were not doing the second line above. Ideally one tap should be detected only when double tap and triple tap fails. And double tap should be detected when triple tap fails.

提交回复
热议问题