06 事件、触摸、响应者链

来源:互联网 发布:淘宝内衣模特雪碧 编辑:程序博客网 时间:2024/06/05 20:40
1.触摸:

重点是重写UIView的4个触摸方法:

1) - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event2)- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent*)event3)- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent*)event4) - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
2.响应者链:

1)检测触摸事件顺序
手机硬件->UIApplication-> window -> viewController-> view ->检测所有视图
2)处理触碰事件顺序
触摸的子视图 -> view -> viewController -> window -> UIApplication->手机硬件
3)阻断响应者链方法。 使无法完成检测查询过程。
视图类的属性 : userInteractionEnabled。设置为NO,关闭后能阻断查询过程。


0 0