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

 

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

1,hitTest:withEvent:方法忽略隐藏的视图(hidden=yes),禁止用户操作的视图(userInteractionEnable=yes),以及alpha<0.01的视图

2,子视图的区域超过父视图的bounds的区域,clipsToBounds=no,超过父视图bound区域的子视图内容也会显示,正常情况下触摸父视图区域之外的子视图区域不会被识别,因为父视图的pointInside:withEvent:方法会返回no,停止向下访问子视图。可以重写pointInside:withEvent:方法来处理这种情况

                                

 

 点击屏幕,此方法会调用3次,前两次是对上一次触摸事件的终结,第3次是当次点击的处理。

 

posted @ 2016-10-21 11:00  大厨子的世界  阅读(579)  评论(0编辑  收藏  举报