iOS 的响应链

2019-10-11  本文已影响0人  NanNan

1、UIView中有两个方法是:

- (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

HItTest:withEvent:方法处理流程大致如下:

寻找第一响应者原理如下:

逻辑图

响应事件逻辑图
上一篇 下一篇

猜你喜欢

热点阅读