iOS Application developer note-1
2016-11-09 本文已影响6人
JKCQW
点击事件 Touch function for system
这四个方法是系统自带方法,方法触发具有图层击穿性,只要顶层图层没有添加其它手势事件,那怕 userInteractionEnabled 被打开,也会触发。
// 点击开始
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
// 点击移动
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
// 点击结束
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
// 点击中断
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
参数解析:touches
此为常用参数,类型为 NSSet ,其内数据为数组形式储存。此中数据仅有 1 组,类型为 UITouch。数据中包含了点击所在 view ,window 上的位置 location;点击次数 tapCount;点击发生时间 time。