3

I have been trying to add this UINavigationController to a subview of my form... All I am getting is a large grey screen.

LiteViewController *lite = [[LiteViewController alloc] initWithNibName:@"LiteViewController" bundle:nil];
[self.view addSubview:lite.navigationController.view];

It should add a full screen navigation controller to the current view.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dave C
  • 399
  • 2
  • 6
  • 13

2 Answers2

1

I found a post, UINavigationController not showing the Root View controller, that worked for me.

Basically you also need to set the view of the navigationController...

[self.view addSubview:navigationController.view];
[navigationController setView:[[navigationController.viewControllers objectAtIndex:0] view]];
Community
  • 1
  • 1
Nate Potter
  • 3,222
  • 2
  • 22
  • 24
0

You might need a makeKeyAndVisible call.

Joost Schuur
  • 4,417
  • 2
  • 24
  • 39
  • To my understanding, the window is visible because I can add other things to the subview and it will work... just this navigationController is giving me a headache. – Dave C Jun 24 '10 at 21:37
  • I'm just getting started with iPhone development, but all the examples I've seen add navigation controllers straight to a UIWindow and not UIView. Maybe, given the full screen nature of this control, it wants to be added to a window? See Apple's docs here too: http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/NavigationControllers/NavigationControllers.html#//apple_ref/doc/uid/TP40007457-CH103-SW1 – Joost Schuur Jun 24 '10 at 21:56