如何屏蔽父view的touch事件到,并且响应self的touch

来源:互联网 发布:加密空间破解软件下载 编辑:程序博客网 时间:2024/04/19 16:36

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
 CGMutablePathRef path = CGPathCreateMutable();
 CGPathMoveToPoint(path,NULL,0,0);
 CGRect rect = CGRectMake(0, 100, 320, 40);
 CGPathAddRect(path, NULL, rect);
 
 if(CGPathContainsPoint(path, NULL, point, NO))
 { 
       [self.superview touchesBegan:nil withEvent:nil];
 } 
 CGPathRelease(path);
 return self;
}

原创粉丝点击