0

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!

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
Brandon
  • 2,163
  • 6
  • 40
  • 64
  • 1
    self.window.rootViewController = self.tabBarController; – Anusha Kottiyal Dec 12 '12 at 09:11
  • You should be getting a warning in launch that is a hint to the solution. – jrturton Dec 12 '12 at 09:13
  • 1
    You did not set the tabBarController as your window's root view controller. You must have get a warning on the debug console telling that windows are expected having a root view controller set. Why do you hide the information from us that you get on the debug console? That is not helpful at all. – Hermann Klecker Dec 12 '12 at 09:17

3 Answers3

1

You are missing rootviewcontroller

Add this

self.window.rootViewController = self.tabBarController;

Hope it helps you..

P.J
  • 6,547
  • 9
  • 44
  • 74
0
self.window.rootViewController = self.tabBarController;

That should do it

MCKapur
  • 9,127
  • 9
  • 58
  • 101
0
self.window.rootViewController = self.tabBarController;
Anusha Kottiyal
  • 3,855
  • 3
  • 28
  • 45