超出父视图部分响应事件

 1 - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
 2     UIView *view = [super hitTest:point withEvent:event];
 3     if (view == nil) {
 4         
 5         for (UIView *subView in self.subviews) {
 6             CGPoint position = [self convertPoint:point toView:subView];
 7             if (CGRectContainsPoint(subView.bounds, position)) {
 8                 view = subView;
 9                 break;
10             }
11         }
12         
13     }
14     return view;
15 }

 

posted @ 2017-02-23 16:58  Emerys  阅读(200)  评论(0编辑  收藏  举报