1:The iOS system detects a finger touch (touch) action, packaged as a Uievent object, into the event queue of the currently active application, passed to the singleton UIWindow to handle- > UIWindow Find the first responder through the event distribution mechanism of the responder chain (as shown in the steps)
Figure II
Join the user click on the view E, the following together with the Diagram II Hit-test view of the process:
1, A is the root view of UIWindow, therefore, the Uiwindwo object will be the prime minister of a hit-test;
2, obviously the user clicks the scope is within the range of a, therefore,pointinside:withevent: Returns the Yes, then will continue to check A's child view;
3. At this time there will be two branches, B and C:
The clicked range is no longer within B, so the pointinside:withevent of the B branch : Return no, corresponding to the hittest:withevent: return nil;
Click on the range in C, that is, C pointinside:withevent: return yes;
4. There are two branches of D and E:
Click the range no longer within D, so D pointinside:withevent: Return No, Corresponding hittest:withevent: returns nil;
The range of clicks is within E, which is E's pointinside:withevent: Returns Yes, because E has no child view (it can also be understood that nil is returned when hit-test to the child view of E), so E's hittest:withevent: will return E, Back again, that is the hittest:withevent of C : return e--->>a hittest:withevent: Return E.
2: If the first responder is not found, the current view is traced up through the responder chain to UIWindow and uiapplication, and if neither of them can handle the event, the event will be discarded
iOS responder Chain