我注意到,在Xcode4.2beta4中使用iPhone Master-Detail模板创建新项目时,它确实:
// AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate>为什么AppDelegate继承自UIResponder而不是NSObject
发布于 2013-07-24 11:52:28
来自Converting to Storyboards Release Notes
注意:在当前的Xcode模板中,应用程序委托类继承自UIResponder。这是为了让委托实例可以参与响应器链,从而处理应用程序级的操作。如果您还没有在现有的应用程序中使用此模式,则没有必要在情节提要中采用它。
发布于 2011-08-01 08:19:46
请查看UIResponder的文档。由于AppDelegate可以响应触摸事件,因此它实现了UIResponder接口。
发布于 2013-07-24 11:41:12
UIResponder是UIKit框架的基类。UIResponder可以处理这些事件。
您的AppDelegate类是UIApplicationMain创建的UIApplication的委托类。AppDelegate符合UIApplicationDelegate协议。
UIResponder类具有获取应用程序窗口焦点的方法,所有视图都将填充到该窗口上,因此您应该有一个继承自UIResponder的类,以便将窗口作为键。
https://stackoverflow.com/questions/6893221
复制相似问题