
需要在UIView中实现下面的方法,这样UIButton超出的部分就可以点击了。
1 2 3 4 5 6 7 8
|
- (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; }
|
近期评论