0420 any class that inherits Uiresponder can act as a responder.response events are passed from bottom to top, and the responder chain is responsive to the high end.Delivery of the corresponding event (from bottom to top to find the view that is interacting with the user's touch)
Guideline: The event is passed by the parent control to the child control, and the view that is most suitable for handling the event is found. If the parent control cannot receive touch events, then the child controls will not be able to receive touch events.
The illustrations are as follows:
UIView does not receive three cases of touch events, such as:
How to find the best view for handling this event
Such as:
Responder chain (from top to bottom, find the first view that implements the touches method)
It is the touch touches method that follows the responder chain from high to the end, and passes on to the previous responder that implements the touches method to respond to the event. If the view's touches method uses super, the touches of the parent class is called in the subclass (this class) Touches. Just like the development of windows, the cell of the video list inherits from a parent view, I only implement the touches method in the parent view, if I implement the touches method in the subclass (and do not use super), Then the parent cannot respond to the touches method because the first view that responds to the touches method is found in the responder chain.
As shown:
Summary: The response event is passed from the bottom to the high, the system to uiapplication processing, uiapplication to the main window (Keywindow) to deal with, the main window based on the view structure to find the most suitable to handle this touch event view, This completes the delivery of the response event. (The view that best handles this event has two criteria: 1, whether it is being touched or not.) 2. Can I handle touch events (there are three criteria for handling touch). Even if you are the best view to handle this event, you don't necessarily have to deal with this event, The responder chain is also used to find the first responder that implements the touches method, which invokes the touches method to handle the touch event. The responder chain is passed by the high end, The view that best handles touch events starts looking to the bottom for the first responder view that implements the touches method, and if the view's touches method also implements the Super method, the parent class responds to the touch call touches method response. So far, The process of the entire touch event is complete.
Interview questions
IOS Advanced 17th Day (0420)