Reputation: 2171
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!
Upvotes: 0
Views: 215
Reputation: 9157
self.window.rootViewController = self.tabBarController;
That should do it
Upvotes: 0
Reputation: 6587
You are missing rootviewcontroller
Add this
self.window.rootViewController = self.tabBarController;
Hope it helps you..
Upvotes: 1