iOS UIView的Touch事件有哪几种触摸事件?
发布于 2020-01-12 22:12:50
关注者
0
被浏览
729
1 个回答
-
处理事件的方法
- UIView是UIResponder的子类,可以覆盖下列4个方法处理不同的触摸事件
//一根或者多根手指开始触摸view - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event //一根或者多根手指在view上移动 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event //一根或者多根手指离开view - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event //触摸结束前,某个系统事件(例如电话呼入)会打断触摸过程 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event