增大view的响应范围

ios 响应链

#pragma mark 增大cell的响应范围(删除按钮) 每次只要查到这里 立马拦截
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    CGPoint pointInButton = [self convertPoint:point toView:self.deleteBigButton];
    return [self.deleteBigButton pointInside:pointInButton withEvent:event] ? self.deleteBigButton : [super hitTest:point withEvent:event];
}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    CGPoint pointInButton = [self convertPoint:point toView:self.deleteBigButton];
    BOOL canDid =  [self.deleteBigButton pointInside:pointInButton withEvent:event];
    if (!canDid) {
        return [super pointInside:point withEvent:event];
    }
    return canDid;
}

你可能感兴趣的:(增大view的响应范围)