Event transfer/handling process

Source: Internet
Author: User


1. Touch the screen with your fingers to generate an event object

2. The system will add this event object to the event queue (first-in-first-out ).

3. The UIApplication extracts the event object from the event queue for processing.

4. UIApplication will first pass the event object to the main UIWindow
(Of course, you must first check whether the UIWindow can receive and pass events)

5. UIWindow traverses all the child controls to see if the touch point falls on a child control:
1> If the touch point is not on the Child control, the UIWindow will directly process the event and the event will be passed.
2> If the touch point falls on the Child control v1, traverse all the child control v1 and repeat the previous step 5.
(Traverse from the last child Control)

6. finally, a UIView object that is most suitable for event processing will be obtained, and a corresponding message will be sent to this UIView object, that is, the corresponding method of calling UIView (touchesBegan ...), notify it to be touched


(That is, the internal processing process of touchesBegan, touchesMoved, and touchesEnded)
// If the three methods are overwritten and the super method is not called, the default method of the parent class is ignored.
1. Default practice:
1> the event object is passed up along the responder chain and will be passed to the UIApplication.
2> If the intermediate chain is broken, it will not be passed up.

2. If the default method of the parent class is overwritten, the event will not be passed up, And the responder chain will be disconnected.

3. Event transmission and event processing are basically inverse processes.

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.