button 超出superView 无法点击解决方法
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *result = [super hitTest:point withEvent:event];
CGPoint buttonPoint = [self.button convertPoint:point fromView:self];
if ([self.button pointInside:buttonPoint withEvent:event]) {
return self.button;
}
return result;
}
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *hitView = [super hitTest:point withEvent:event];
if(hitView == self){
return nil;
}
return hitView;
}
网友评论