1, Uievent Introduction
Uievent is an event on behalf of an iOS system, one event containing one or more uitouch;
Uievent is divided into four categories: Uieventtype
typedef ns_enum (Nsinteger, Uieventtype) { uieventtypetouches,// Touch Event Type iOS3.0 can be used after uieventtypemotion,// Shake event type iOS3.0 can be used after Uieventtyperemotecontrol,// remote Event Type iOS4.0 can be used after uieventtypepresses Ns_enum_available_ios (9_ 0),// Physical button Event type iOS9.0 can be used after };
Child Event Type: Uieventsubtype
typedef ns_enum (Nsinteger, uieventsubtype) {//event does not have subtype iOS3.0 can be used afterUieventsubtypenone =0, //Event Sub-type the device iOS3.0 can be used after shakingUieventsubtypemotionshake =1, //Remote Event subtype iOS4.0 can be used afterUieventsubtyperemotecontrolplay = -,//PlayUieventsubtyperemotecontrolpause =101,//PauseUieventsubtyperemotecontrolstop =102,//StopUieventsubtyperemotecontroltoggleplaypause =103,//toggle between play and pause "action: Play or pause, press the headset in the middle of the line control button"Uieventsubtyperemotecontrolnexttrack =104,//Next "action: Press the Headset line control middle button twice"Uieventsubtyperemotecontrolprevioustrack = the,//previous "Action: Press the Headset Line control middle button three down"Uieventsubtyperemotecontrolbeginseekingbackward =106,//Rewind Start Action: Press the Headset Line Control Center button Three, don't let go.Uieventsubtyperemotecontrolendseekingbackward =107,//Rewind End "action: Press the Headset Line Control Center button three down to the position of the fast-rewind release"Uieventsubtyperemotecontrolbeginseekingforward =108,//Quick-forward Start action: Press the headset's middle button and don't release it.Uieventsubtyperemotecontrolendseekingforward =109,//Quick-forward End "Operation: Press the Headset Control center button two down to the fast-forward position release"};
2. Related API
Ns_class_available_ios (2_0)@interfaceUievent:nsobject@property (nonatomic,ReadOnly) Uieventtype type Ns_available_ios (3_0);//Event Type@property (Nonatomic,ReadOnly) Uieventsubtype subtype Ns_available_ios (3_0);//Child Event Type@property (nonatomic,ReadOnly) Nstimeinterval timestamp;//Event Occurrence Time//returns all touch objects associated with the receiver. #ifUikit_define_as_properties@property (nonatomic,ReadOnly, nullable) Nsset <uitouch *> *alltouches;#else-(Nullable Nsset <uitouch *> *) alltouches;#endif-(Nullable Nsset <uitouch *> *) Touchesforwindow: (UIWindow *) window;//returns a touch object belonging to a given view that represents the event represented by the sink. -(Nullable Nsset <uitouch *> *) Touchesforview: (UIView *) view;//returns the Touch object that belongs to the event response of the receiver of a given window. -(Nullable Nsset <uitouch *> *) Touchesforgesturerecognizer: (Uigesturerecognizer *) gesture Ns_available_ios (3_2 );//return Touch object is passed to special gesture recognition//Will put the lost touch into a new uievent array, you can use Coalescedtouchesfortouch (_:) method to access-(Nullable Nsarray <uitouch *> *) Coalescedtouchesfortouch: (Uitouch *) Touch Ns_available_ios (9_0);//Auxiliary Uitouch Touch, predicting the occurrence of a series of major touch events. These predictions may not exactly match the real behavior of the touch as it moves, so they should be interpreted as an estimate. -(Nullable Nsarray <uitouch *> *) Predictedtouchesfortouch: (Uitouch *) Touch Ns_available_ios (9_0);@end
Introduction to iOS Development Uievent events