首页 > 技术文章 > 触摸事件MultiTouch Events

hepingqingfeng 2016-05-05 17:45 原文

 

备注:

userInteractionEnabled = NO

hidden = YES

alpha = 0.0~0.01    //如果上面三个属性被设置了则无法接收触摸事件

 

 

1、- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event   触摸开始(手指刚碰到view)

备注:

1.1、如果两根手指同时触摸一个view,那么view只会调用一次touchesBegan:withEvent:方法,touches参数中装着2个UITouch对象
2、- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event    触摸ing(手指在view上面挪来挪去)
 
3、- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event    触摸结束(手指离开view)
 
4、- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;      触摸意外取消时执行(例如正在触摸时打入电话)
 
6、touches参数包含的属性
       6.1、window:触摸时所在的窗口
       6.2、view:触摸时所在视图
       6.3、tapCount:短时间内点击的次数
       6.4、timestamp:触摸产生或变化的时间戳
       6.5、phase:触摸周期内的各个状态
      touches包含的方法
       6.6、locationInView:方法:取得在指定视图的位置
       6.7、previousLocationInView:方法:取得移动的前一个位置
 
 
 

推荐阅读