应用程序打开到空白黑屏 [英] App Opening to Blank Black Screen

查看:33
本文介绍了应用程序打开到空白黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个将导航控制器嵌入到 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;

希望能帮到你..

这篇关于应用程序打开到空白黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆