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;

}

透明View遮盖无法点击

- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event{

UIView *hitView = [super hitTest:point withEvent:event];

if(hitView == self){

return nil;

}

return hitView;

}

上一篇下一篇

猜你喜欢

热点阅读