點擊事件 Touch function for system
這四個方法是系統(tǒng)自帶方法输虱,方法觸發(fā)具有圖層擊穿性油宜,只要頂層圖層沒有添加其它手勢事件沪饺,那怕 userInteractionEnabled 被打開际跪,也會觸發(fā)商佛。
// 點擊開始
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
// 點擊移動
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
// 點擊結(jié)束
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
// 點擊中斷
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
參數(shù)解析:touches
此為常用參數(shù),類型為 NSSet 姆打,其內(nèi)數(shù)據(jù)為數(shù)組形式儲存良姆。此中數(shù)據(jù)僅有 1 組,類型為 UITouch幔戏。數(shù)據(jù)中包含了點擊所在 view 玛追,window 上的位置 location;點擊次數(shù) tapCount闲延;點擊發(fā)生時間 time痊剖。