应用程序打开到空白黑屏
问题描述:
我正在制作一个将导航控制器嵌入到 tabbarcontroller 的应用程序.现在,当我打开应用程序时,我只看到一个空白的黑屏.
I am making an app that embeds a navigationcontroller into a tabbarcontroller. Now when I open the app I am getting just a blank black screen.
这是我的代码
PDCFirstViewController *viewController1 = [[PDCFirstViewController alloc]
initWithNibName:@"PDCFirstViewController" bundle:nil];
PDCSecondViewController *viewController2 = [[PDCSecondViewController alloc]
initWithNibName:@"PDCSecondViewController" bundle:nil];
ViewController *viewController3 = [[ViewController alloc]
initWithNibName:@"ViewController" bundle:nil];
UINavigationController *navigationcontroller = [[UINavigationController alloc]
initWithRootViewController:viewController3];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray
arrayWithObjects:viewController1,viewController2,navigationcontroller, nil];
[self.window makeKeyAndVisible];
我需要添加一些东西或做一些不同的事情来让应用程序显示吗?任何帮助都会很棒!谢谢!
Do I need to add something or do something different to make the app display? Any assistance would be great! Thank you!
答
您缺少 rootviewcontroller
添加这个
self.window.rootViewController = self.tabBarController;
希望能帮到你..