Altering the Responder Chain
变更响应链
You can alter the responder chain by overriding the next property of your responder objects. When you do this, the next responder is the object that you return.
你可以通过重写响应对象的下一个来改变响应者。当你那么做的时候,下一个响应者就是你返回的对象。
Many UIKit classes already override this property and return specific objects, including:
许多UIKit类都重写了这个属性,返回了具体的对象,包括:
UIView objects. If the view is the root view of a view controller, the next responder is the view controller; otherwise, the next responder is the view’s superview.
对于UI对象,如果是控制器的view,下一个响应者是控制器,否则下个响应者是视图的父视图。
UIViewController objects.
控制器对象
If the view controller’s view is the root view of a window, the next responder is the window object.
如果这个控制器的视图是window的根视图,下一个响应者就是window对象
If the view controller was presented by another view controller, the next responder is the presenting view controller.
如果这个控制器被另一个控制器present,下一个响应者是presenting控制器。
UIWindow objects. The window's next responder is the UIApplication object.
window的先一个响应者是应用程序对象
UIApplication object. The next responder is the app delegate, but only if the app delegate is an instance of UIResponder and is not a view, view controller, or the app object itself.
下一个响应者是APP的delegate,但是只有这个代理对象是UIResponder的实例,不是view,也不是控制器和APP自己。