How to block a gesture from superview to subview?

前端 未结 6 1907
感动是毒
感动是毒 2020-12-30 11:32

I\'m writing a module that everytime I swipe on a view, two sub views with a half size of the view will be added. Those subviews have their own gestures (eg: pan,...). The f

6条回答
  •  一生所求
    2020-12-30 11:47

    set userinteractionEnabled to NO of your subView

     subview.userinteractionEnabled=NO
    

    if you dont want to disable userInteraction then use cancelsTouchesInView method

    cancelsTouchesInView—If a gesture recognizer recognizes its gesture, it unbinds the remaining touches of that gesture from their view (so the window won’t deliver them). The window cancels the previously delivered touches with a (touchesCancelled:withEvent:) message. If a gesture recognizer doesn’t recognize its gesture, the view receives all touches in the multi-touch sequence.

提交回复
热议问题