本文主要是介绍hitTest,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{//把自己的点转成控件坐标系上的点CGPoint currentPoint = [self convertPoint:point toView:self];if ([_button pointInside:currentPoint withEvent:event]) {return nil;}return [super hitTest:point withEvent:event];}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{CGPoint currentPoint = [self convertPoint:point toView:self];if ([_button pointInside:currentPoint withEvent:event]) {return NO;}return [super pointInside:point withEvent:event];
}
这篇关于hitTest的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!