IOS-Event handling process (supplemental)

Source: Internet
Author: User

The complete process of event handling
    • 1> first passes the event object from top to bottom (passed by the parent control to the child control), and finds the most appropriate control to handle the event.

    • 2> calls the touches of the most appropriate control .... method

    • 3> if [super touches ...] is called, the event is passed up the responder chain to the previous responder

    • 4> then calls the last responder's touches .... method

How to determine the previous responder
    • 1> If the current view is a view of the controller, then the controller is the last responder

    • 2> If the current view is not the controller's view, then the parent control is the last responder

The event delivery process for the responder chain
    • If the view controller is present, it is passed to the controller, and if the controller does not exist, it is passed to its parent view
    • In the top-most view of the view hierarchy, if you cannot process the received event or message, it passes the event or message to the Window object for processing
    • If the window object is not processed, it passes the event or message to the UIApplication object
    • If UIApplication cannot process the event or message, it is discarded

Response person

    1. The touches method is to pass the event up the chain in response to the previous responder for processing.
    2. The default method [Super touches ... withevent ...];
    3. A control that responds to an event must implement the override touches method, handle the event in its method, and implement the response.
    4. The principle of multi-control processing is 1 on the responder chain, and is the parent control of its control 2 and implements the touches method.

IOS-Event handling process (supplemental)

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.