问题
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.
Here is my code
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!
回答1:
You are missing rootviewcontroller
Add this
self.window.rootViewController = self.tabBarController;
Hope it helps you..
回答2:
self.window.rootViewController = self.tabBarController;
回答3:
self.window.rootViewController = self.tabBarController;
That should do it
来源:https://stackoverflow.com/questions/13836189/app-opening-to-blank-black-screen