IOS Event Delivery and response process

Source: Internet
Author: User
Tags uikit

IOS Event Delivery and response process

-->> Event Arrival-->> Event Distribution-->> Event response

Event (events)

Official documents (Events (IOS)) are described in this way:
Users manipulate their IOS devices in a number of ways, such as touching the screen or shaking the device. IOS interprets when and how a user was manipulating the hardware and passes this information to your app. The more your app responds to actions in natural and intuitive ways, the more compelling the experience are for the user.
1. Touch Events (single point of events, multi-touch and various gestures)
2. Rocking Time (Motion Events) (Gravity, acceleration and other sensors)
3. Remote Control Events (Remote-control events) (wire-controlled headphones, AirPlay, etc.)

Event Distribution (Delivery)

Touch events: Hardware Interrupts---UIKit packaged into Uievent objects-->uiapplication objects->key window->hit-testing V Iew
Other events: Key Window-> First Responder
Objective:
The ultimate goal of these event paths is to find a object that can handle and respond to an event. Therefore, UIKit first sends the event to the object that's best suited to handle the event. For touch events, this object is the Hit-test view, and for other events, this object is the first responder.
Method:
-Hit-testing Returns The View Where A touch occurred (touch)
The Hit-test view is given the first opportunity to handle a touch event. If The Hit-test view cannot handle an event, the event travels up, the view ' s chain of responders as described in "the Re Sponder Chain is made up of Responder Objects "until the system finds a object that can handle it.
-The Responder Chain is made up of Responder Objects (Motion Or r-c)

Incident response


Attention:
Hittest:withevent: The method will ignore the view (hidden = YES)
View that prohibits user action (userinteractionenabled = NO)
And a view with an alpha level less than 0.01 (Alpha < 0.01)
If the area of a child view exceeds the bound area of the parent view (the clips Tobounds property of the parent view is no, so that the contents of the view beyond the parent view's bound area will also be displayed), then the touch operations of the child view outside the parent view are not recognized by the parent view normally. Because the parent view's Pointinside:withevent: Method returns no, this does not continue to facilitate the sub-view downward. Of course, you can also override the Pointinside:withevent: method to handle this situation.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

IOS Event Delivery and response process

Related Article

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.