Brandon
Brandon

Reputation: 2171

App Opening to Blank Black Screen

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

Answers (3)

MCKapur
MCKapur

Reputation: 9157

self.window.rootViewController = self.tabBarController;

That should do it

Upvotes: 0

P.J
P.J

Reputation: 6587

You are missing rootviewcontroller

Add this

self.window.rootViewController = self.tabBarController;

Hope it helps you..

Upvotes: 1

Anusha Kottiyal
Anusha Kottiyal

Reputation: 3905

self.window.rootViewController = self.tabBarController;

Upvotes: 0

Related Questions