小爷的爷

UIKit框架之UIEvent

1.继承链:NSObject

2.事件大致可以分为三种事件:触摸事件、动作事件、遥控事件

3.获取事件的touches

    (1)- (NSSet<UITouch *> *)allTouches  :返回和接收者相关的所有触摸

    (2)- (NSSet<UITouch *> *)touchesForView:(UIView *)view  :返回指定视图的触摸

    (3)- (NSSet<UITouch *> *)touchesForWindow:(UIWindow *)window  :返回指定窗口的触摸

4.获取事件属性

    (1)@property(nonatomicreadonlyNSTimeInterval timestamp  :获取事件发生的时间

5.获取事件的类型

    (1)@property(nonatomicreadonlyUIEventType type  :获取事件的类型

    (2)@property(nonatomicreadonlyUIEventSubtype subtype  :返回事件的子类型

6.获取手势识别器的touches

    (1)- (NSSet<UITouch *> *)touchesForGestureRecognizer:(UIGestureRecognizer *)gesture  :返回传送给指定手势识别器的触摸对象

7.数据类型

    (1)UIEventType;类型

UIEventTypeTouches,和屏幕相关的触摸事件

UIEventTypeMotion,和设备移动、动过相关的事件

UIEventTypeRemoteControl,远程遥控事件

UIEventTypePresses,物理按钮被按的事件

    (2)UIEventSubtype的类型

UIEventSubtypeNone = 0,  :该事件没有子类型

UIEventSubtypeMotionShake = 1,  :动作、摇动类型

UIEventSubtypeRemoteControlPlay = 100,  :遥控、视频或者音频播放

UIEventSubtypeRemoteControlPause = 101,  :遥控、视频或者音频中止

UIEventSubtypeRemoteControlStop = 102,  :遥控、视频或者音频停止

UIEventSubtypeRemoteControlTogglePlayPause = 103,  :遥控、视频和音频播放和停止

UIEventSubtypeRemoteControlNextTrack = 104,  :遥控、视频或者音频跳到下一个

UIEventSubtypeRemoteControlPreviousTrack = 105,  :遥控、视频或者音频回放到上一个

UIEventSubtypeRemoteControlBeginSeekingBackward = 106,  :遥控、视频或者音频开始向后移动

UIEventSubtypeRemoteControlEndSeekingBackward = 107,  :遥控、视频或者音频结束向后移动

UIEventSubtypeRemoteControlBeginSeekingForward = 108,  :遥控、视频或者音频开始向前移动

UIEventSubtypeRemoteControlEndSeekingForward = 109,  :遥控、视频或者音频结束向前移动

posted on 2016-07-31 15:32  小爷的爷  阅读(398)  评论(0编辑  收藏  举报