Summary of the delivery process for iOS events

Source: Internet
Author: User

1 I. The process of passing events2 1the user taps the screen to produce a uievent (Touch event) Object3 2. UIApplication first receives this event and adds the event to an event queue4 3. UIApplication all events in the event queue are sequentially fetched for delivery and processing5 4. UIApplication first passes the event object to the app's main window6 5The main window finds the most appropriate uiview to handle this event.7 1> UIApplication, UIWindowController.view8 2> uiapplication, UIWindow, Controller.viewGreen9 3> uiapplication, UIWindow, Controller.viewYellowTen 4> uiapplication, UIWindow, Controller.view, yellow-blueRed One  A 6The UIView of the following conditions are those that cannot receive and handle events. - 1> userinteractionenabled =NO; - 2> hidden =YES; the 3> Alpha =0~0.01 -  - self.view.subviews -[0,1,2,3] +  - 7When the event is passed to the controller's view: + 1>if the controller's view cannot receive events, the event is passed to this end A 2>if the controller's view can receive events, it is judged that the touch point is not on the controller's view at(1If the touch point is not on the view of the controller, the event is passed to this end -(2If the touch point is above the view of the controller, all child controls of the controller's view are traversed (reversed) -* If this child control cannot handle the event,Continue, traversing the next child control -*If the child control can handle the event, the touch point is not on the child control -# If the touch point is not above the child control,Continue, traversing the next child control -# If the touch point is above this child control, traverse its child controls again, repeating the previous (2) of the process in           - 3>if the appropriate child control cannot be found to handle the event, it is passed to the control itself to handle the event to  + 4>in general, it is first to determine whether the event can be handled, and then determine the touch point is not within the current control scope -  the 5>once the most appropriate child control is found, let the child control handle the event: * call the Touchesbegan of the child control and other methods for processing $ Panax Notoginseng 8process of the Touchesbegan method of the. Super - 1>Super will pass the Uievent (event) object back the 2>passing events to your own nextresponder,nextresponder is eligible to handle the event + (there is a chance to call Nextresponder's Touchesbegan method) A 3>if the current responder object does not call the super's Touchesbegan method, the event ends the 4>If the current view is not the view of the controller, it is returned directly to Superview + If the current view is a view of the controller, it is passed back directly to the controller. The controller is then passed back to the window and finally to the Uiappilcation -  $ 9. The delivery process of an event $ //-(UIView *) HitTest: (cgpoint) point withevent: (Uievent *) event; - 1> UIApplication-UIWindow *window; -UIView *hittestview =[window Hittest:point withevent:envent]; the  - Wuyi Tenthe complete delivery and processing of events the 1> User taps the screen to generate a uievnent *evt object, and produces a touch point cgpoint, which receives this event by UIApplication -  Wu 2>UIApplication will call -UIView *myview =[window Hittest:point widthevent:evt]; About used to get the first uiview to handle touch events $  - 3> Let MyView handle this touch event, call MyView Touchesbegan and other methods

Summary of the delivery process for iOS events

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.