How can I pass a gesture recognizer from one view to another

后端 未结 1 455
忘了有多久
忘了有多久 2021-01-05 05:58

I have a view which contains several subviews which are complex controls with several buttons. The superview has gesture recognizers for taps, swipes etc.

In some ca

1条回答
  •  不思量自难忘°
    2021-01-05 06:27

    Well, you could create a custom view inheriting from UIView and then override:

    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    

    From this method you can return the view you want to handle the event.

    take a look at: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/hitTest:withEvent:

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题