UIResponder与UIView的触摸事件处理
来源:互联网 发布:工作休息提醒软件 编辑:程序博客网 时间:2024/05/17 21:55
一、UIResponder
UIResponder内部提供了以下方法来处理事件
触摸事件
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
加速计事件
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event;
远程控制事件
- (void)remoteControlReceivedWithEvent:(UIEvent *)event;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
加速计事件
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event;
远程控制事件
- (void)remoteControlReceivedWithEvent:(UIEvent *)event;
二、UIView的触摸事件处理
UIView是UIResponder的子类,可以实现下列4个方法处理不同的触摸事件
一根或者多根手指开始触摸view,系统会自动调用view的下面方法
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
一根或者多根手指在view上移动,系统会自动调用view的下面方法(随着手指的移动,会持续调用该方法)
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
一根或者多根手指离开view,系统会自动调用view的下面方法
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
触摸结束前,某个系统事件(例如电话呼入)会打断触摸过程,系统会自动调用view的下面方法
(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
注意:touches中存放的都是UITouch对象
一根或者多根手指开始触摸view,系统会自动调用view的下面方法
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
一根或者多根手指在view上移动,系统会自动调用view的下面方法(随着手指的移动,会持续调用该方法)
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
一根或者多根手指离开view,系统会自动调用view的下面方法
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
触摸结束前,某个系统事件(例如电话呼入)会打断触摸过程,系统会自动调用view的下面方法
(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
注意:touches中存放的都是UITouch对象
0 0
- UIResponder与UIView的触摸事件处理
- Ui16-触摸事件与UIResponder
- UIView的点击事件与触摸手势
- UIView的点击事件与触摸手势
- ios触摸事件三:UIResponder
- iOS UIView的点击事件与触摸手势
- iOS UIView的点击事件与触摸手势
- iOS UIView的点击事件与触摸手势
- iOS UIView的点击事件与触摸手势
- Android触摸事件的传递与处理
- 触摸事件的分发与处理
- android 触摸事件的处理与总结
- UIView 触摸事件探究
- UITouch/UIResponder:iOS上触摸事件的视图检测和事件传递
- UIResponder事件处理 _Lenny Kwok
- vickate _触摸事件处理 实现UIView替代UIButton
- android的触摸事件处理
- View的触摸事件处理
- PHP中几个小问题
- Linux中的umask系统变量的笔记
- 光驱坏了,用什么方法可以解决装机问题#
- 关于PHP中的文件包含方法
- 内部版本7600无法安装ie9浏览器
- UIResponder与UIView的触摸事件处理
- 嵌入式linux/Android系统详细启动流程解析
- Uva 103-Stacking Boxes(DP/矩形嵌套)
- timestamp的两个属性:CURRENT_TIMESTAMP 和ON UPDATE CURRENT_TIMESTAMP
- PHP开发过程中的几种调试方法
- Android 开发之Navigation Drawer
- [Android]反编译apk + eclipse中调试smali
- 从trc查找死锁的问题
- PHP中用file_get_contents抓取网页