代码片段 超出父视图 事件点击
2019-12-31 本文已影响0人
梓华
参考
https://www.jianshu.com/p/5e86f900b3cc
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView *view = [super hitTest:point withEvent:event];
CGPoint tempPoint = [self.editBtn convertPoint:point fromView:self];
if([self.editBtn pointInside:tempPoint withEvent:event])
{
return self.editBtn;
}
return view;
}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
return ([super pointInside:point withEvent:event]
|| CGRectContainsPoint(_tipView.frame, point)
);
}