应用程序应该在应用程序启动结束时有一个根视图控制器 [英] Applications are expected to have a root view controller at the end of application launch
本文介绍了应用程序应该在应用程序启动结束时有一个根视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的控制台出现以下错误:
I get the following error in my console:
应用程序应该在应用程序启动结束时有一个根视图控制器
Applications are expected to have a root view controller at the end of application launch
下面是我的 application:didFinishLaunchWithOptions
方法:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Set Background Color/Pattern
self.window.backgroundColor = [UIColor blackColor];
self.tabBarController.tabBar.backgroundColor = [UIColor clearColor];
//self.window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"testbg.png"]];
// Set StatusBar Color
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
// Add the tab bar controller's current view as a subview of the window
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
在 Interface Builder 中,UITabBarController
的委托连接到应用程序委托.
In Interface Builder, the UITabBarController
's delegate is hooked up to the App Delegate.
有人知道如何解决这个问题吗?
Anyone know how to fix this issue?
推荐答案
在 AppDelegate 中替换
Replace in AppDelegate
[window addSubview:[someController view]];
到
[self.window setRootViewController:someController];
这篇关于应用程序应该在应用程序启动结束时有一个根视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文