How to compare the types of gestures on iOS?

后端 未结 3 1806
囚心锁ツ
囚心锁ツ 2020-12-19 15:28

I have three different gestures with two different types on one view.

First is a UITapGestureRecognizer and the two others are UILongPressGestureR

3条回答
  •  囚心锁ツ
    2020-12-19 16:10

    Can check the class of the UIGestureRecognizer
    For example:

    -(BOOL) gestureRecognizer: (UIGestureRecognize *) gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer *) otherGestureRecognizer {
        if ([gestureRecognizer isMemberOfClass: [UILongPressGestureRecognizer class]]) {
           //do stuff
        }
    //etc
    }
    

提交回复
热议问题