hitTest

来源:互联网 发布:淘宝助理是免费的吗 编辑:程序博客网 时间:2024/06/07 04:32

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{    //把自己的点转成控件坐标系上的点    CGPoint currentPoint = [self convertPoint:point toView:self];        if ([_button pointInside:currentPoint withEvent:event]) {        return nil;    }        return [super hitTest:point withEvent:event];    }


- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{    CGPoint currentPoint = [self convertPoint:point toView:self];        if ([_button pointInside:currentPoint withEvent:event]) {        return NO;    }    return [super pointInside:point withEvent:event];}


0 0
原创粉丝点击