iOS响应超出View范围点击事件

// 在view中重写以下方法,其中self.button就是那个希望被触发点击事件的按钮
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
   UIView *view = [super hitTest:point withEvent:event];
   if (view == nil) { // 转换坐标系
    CGPoint newPoint = [self.button convertPoint:point fromView:self];
    // 判断触摸点是否在button上
    if (CGRectContainsPoint(self.button.bounds, newPoint)){
       view = self.deleteButton;
    }
  }
  return view;
}
 
详细原理:http://www.cnblogs.com/yang-shuai/p/9014240.html
 
参考:https://www.jianshu.com/p/1e6ae1b4cdc0
 
原文地址:https://www.cnblogs.com/yang-shuai/p/9014300.html