标签:
For the app on the left, the event follows this path:
The initial view attempts to handle the event or message. If it can’t handle the event, it passes the event to itssuperview, because the initial view is not the top most view in its view controller’s view hierarchy.
The superview attempts to handle the event. If the superview can’t handle the event, it passes the event to its superview, because it is still not the top most view in the view hierarchy.
The topmost view in the view controller’s view hierarchy attempts to handle the event. If the topmost view can’t handle the event, it passes the event to its view controller.
The view controller attempts to handle the event, and if it can’t, passes the event to the window.
If the window object can’t handle the event, it passes the event to the singleton app object.
If the app object can’t handle the event, it discards the event.
The app on the right follows a slightly different path, but all event delivery paths follow these heuristics:
A view passes an event up its view controller’s view hierarchy until it reaches the topmost view.
The topmost view passes the event to its view controller.
The view controller passes the event to its topmost view’s superview.
Steps 1-3 repeat until the event reaches the root view controller.
The root view controller passes the event to the window object.
The window passes the event to the app object.
标签:
原文地址:http://www.cnblogs.com/hellovoidworld/p/4221049.html