


事件传递的两个核心方法
- (nullable UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event; // recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system
- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event; // default returns YES if point is in bounds
第一个方法返回的是一个UIView,是用来寻找最终哪一个视图来响应这个事件
第二个方法是用来判断某一个点击的位置是否在视图范围内,如果在就返回YES
网友评论