本文介绍了应用程序在应用程序启动结束时应该有一个根视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I get the following error in my console:
Applications are expected to have a root view controller at the end of application launch
Below is my application:didFinishLaunchWithOptions
method:
- (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;
}
In Interface Builder, the UITabBarController
's delegate is hooked up to the App Delegate.
Anyone know how to fix this issue?
解决方案
Replace in AppDelegate
[window addSubview:[someController view]];
to
[self.window setRootViewController:someController];
这篇关于应用程序在应用程序启动结束时应该有一个根视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!