“rootViewController” UIWindow 的出口在 iOS 4.0 之前的版本中不可用
我在 iOS 4.0 之前的版本中收到以下错误:
The 'rootViewController' outlet of UIWindow is not available on releases prior to iOS 4.0. Remove the connection and instead programmatically add the view controller's view to the window after the application finishes launching.
如何以及在哪里以编程方式执行此操作?
I am getting the following error on pre-iOS 4.0 builds:
The 'rootViewController' outlet of UIWindow is not available on releases prior to iOS 4.0. Remove the connection and instead programmatically add the view controller's view to the window after the application finishes launching.
How and where do I do this programmatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有一个 CoolViewController 类。
在 CoolAppDelegate.h 中,您需要有这样的内容:
然后您的 CoolAppDelegate.m 需要
带有如下代码的方法:
为了避免错误,您可能还需要删除对指向 rootViewController 的 IBOutlet 的引用通过 Interface Builder 在您的 .xib 文件中。
Let's pretend you have a CoolViewController class.
Inside your CoolAppDelegate.h you need to have something like this:
Then your CoolAppDelegate.m would need the
method with some code like this:
To avoid the error you'll probably need also to remove the reference to the IBOutlet that points to the rootViewController in your .xib file via Interface Builder.