iOS - Multiple Tap gesture recognizers

后端 未结 2 960
梦毁少年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.

    0 讨论(0)
  • 2021-01-05 13:14

    Change your 2 requireGestureRecognizerToFail calls to:

    [oneTap requireGestureRecognizerToFail:tripleTap];
    [oneTap requireGestureRecognizerToFail:doubleTap];
    [doubleTap requireGestureRecognizerToFail:tripleTap];  
    
    0 讨论(0)
提交回复
热议问题