uiview hitTest
2016-11-09 本文已影响29人
那是什么
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;
}