[英]iOS Application launch black screen, UINavigationController, Nib, RootViewController
I've got the following app, whose RootViewController
is named TopicsViewController
. 我有以下应用程序,其
RootViewController
名为TopicsViewController
。
When I run it, there aren't any errors or breaks but the screen is black . 当我运行它时,没有任何错误或中断,但屏幕为黑色 。 No table, populated or empty, just a black screen.
没有表格,填充或空着,只有黑屏。 Not sure which of the following is happening:
不知道发生以下情况:
didFinishLaunchingWithOptions
method in relation to a parser initlizing in it? didFinishLaunchingWithOptions
方法与在其中初始化的解析器有关吗? TopicsViewController
? TopicsViewController
nib文件有关吗? I can show more code from my TopicsViewController
class if needed. 如果需要,我可以从
TopicsViewController
类中显示更多代码。
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
///////////////////////////////////////////
***initializing code for parser which populates TopicsViewController (not shown to save space)*****
///////////////////////////////////////////
UIViewController *rootController =
[[TopicsViewController alloc]
initWithNibName:@"TopicsViewController" bundle:nil];
navController = [[UINavigationController alloc]
initWithRootViewController:rootController];
self.window = [[UIWindow alloc]
initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window addSubview:navController.view];
[self.window makeKeyAndVisible];
return YES;
}
Instead of: 代替:
[self.window addSubview:navController.view];
Write: 写:
self.window.rootViewController = self.navController;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.