标签:
/**
* 在父视图中重写该方法,这样可使超出部分响应事件。
*/
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *view = [super hitTest:point withEvent:event];
if (view == nil) {
for (UIView *subView in self.subviews) {
CGPoint tp = [subView convertPoint:point fromView:self];
if (CGRectContainsPoint(subView.bounds, tp)) {
view = subView;
}
}
}
return view;
}
让超出父视图范围的子视图响应事件,在UIView范围外响应点击
标签:
原文地址:http://www.cnblogs.com/weiboyuan/p/5688937.html