Three big events in iOS

Source: Internet
Author: User

  in IOS, all objects that appear on the interface are inherited directly or indirectly from Uiresponder, and can only handle events if they inherit it. The events in iOS can be categorized into three main categories:

1. Touch Events

2. Accelerometer events (Shake)

3. Remote Control Events

  As long as the finger touches the screen, slides, and leaves the screen, the system generates an event of the Uievent object type---Of course including the Uitouch event

   

1 /* * 2 *  start touch (i.e. finger touch screen (view) that moment)3  */ 4 -(void) Touchesbegan: (Nsset *) touches withevent: (uievent *)event;
1 /* * 2 *  touch in progress ....  3  */4 -(void) touchesmoved: (Nsset *) touches withevent: ( Uievent *)event;
/* * *   */-(void) touchesended: (Nsset *) touches withevent: (uievent *)event;
1 /* * 2 *  Touch Interrupt 3  */ 4 -(void) touchescancelled: (Nsset *) touches withevent: (uievent *)event;

IOS 3.0 + starts to support motion events, especially shaking devices, such as the shake-and-shake feature in.

Execution at start of movement
-(void) Motionbegan: (uieventsubtype) Motion withevent: (uievent *)event Ns_available_ios (3_0);
Execution at the end of the campaign
-(void) motionended: (uieventsubtype) Motion withevent: (uievent *)event Ns_available_ios (3_0);
Execution when motion is canceled
-(void) motioncancelled: (uieventsubtype) Motion withevent: (uievent *)event Ns_available_ios (3_0);

  IOS 4.0 + start to support remote events

-(void) Remotecontrolreceivedwithevent: (uievent *)event Ns_available_ios (4_0);

The following is an enumeration definition of three types of event Uieventtype
typedef ns_enum (Nsinteger, Uieventtype) {uieventtypetouches, uieventtypemotion, uieventtyperemotecontrol,};typed EF Ns_enum (Nsinteger, uieventsubtype) {
//available in IPhone OS 3.0Uieventsubtypenone =0, //for Uieventtypemotion, available in IPhone OS 3.0Uieventsubtypemotionshake =1, //for Uieventtyperemotecontrol, available in IOS 4.0Uieventsubtyperemotecontrolplay = -, Uieventsubtyperemotecontrolpause=101, Uieventsubtyperemotecontrolstop=102, Uieventsubtyperemotecontroltoggleplaypause=103, Uieventsubtyperemotecontrolnexttrack=104, Uieventsubtyperemotecontrolprevioustrack= the, Uieventsubtyperemotecontrolbeginseekingbackward=106, Uieventsubtyperemotecontrolendseekingbackward=107, Uieventsubtyperemotecontrolbeginseekingforward=108, Uieventsubtyperemotecontrolendseekingforward=109,};

  

Three big events in iOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.