iOS

iOS UIView的Touch事件有哪几种触摸事件?

发布于 2020-01-12 22:12:50
关注者
0
被浏览
729
1 个回答
  • 面试哥
    面试哥 2020-01-12
    为面试而生,有面试问题,就找面试哥。

    处理事件的方法

    • 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
    
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看