美文网首页
iOS Application developer note-1

iOS Application developer note-1

作者: JKCQW | 来源:发表于2016-11-09 15:37 被阅读6次

点击事件 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。

相关文章

网友评论

      本文标题:iOS Application developer note-1

      本文链接:https://www.haomeiwen.com/subject/zaxtpttx.html