The "iOS Dev-88" event delivery principle explains which control handles events and how the responder chain is introduced

Source: Internet
Author: User

First, the touch event transfer principle

(1) The large direction is: passed from the parent control to the child control.

--The parent control checks whether it can accept event handling first

--and then look at the touch that's not in your own range

--if so, iterate over the child controls. See if there are any suitable child controls to handle

--assuming that the child controls are not appropriate, then the parent control will handle it on its own.

Another big rule is that events are usually from uiapplication >>> UIWindow >>> Individual controls


Second, the responder chain

--After finding this control, see if this control has implemented touches began, moved, and ended events.

--assuming no, then it will look for its parent control, which in turn pushes up.

--assuming that the control implements the method and also uses [super ...], then both the parent control and it can make the processing. So, be able to use [super ...] Enables multiple controls to handle the same event .


Note: special cases. Assuming that the current view is the view of the controller, then the previous responder of the view is the controller.

The "iOS Dev-88" event delivery principle explains which control handles events and how the responder chain is introduced

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.