Presenting a Modal View Controller hides the Navigation Bar Presenting a Modal View Controller hides the Navigation Bar objective-c objective-c

Presenting a Modal View Controller hides the Navigation Bar


Make sure you a presenting AND dismissing the modalViewController from the UINavigationController, like so:

// show[self.navigationController presentModalViewController:vc animated:YES];// dismiss[self.navigationController dismissModalViewControllerAnimated:YES];

If your view controller is actually on the UINavigationController's stack then this is the correct way to handle the presentation and dismissal of the modal view controller. If your UINavigationBar is still hidden, there is something else funky going on and we would need to see your code to determine what is happening.

Edit

I copied your code into an app of mine and the UIImagePickerController successfully presented and dismissed and my UINavigationController's UINavigationBar was still there. I truly believe that the problem lays elsewhere in your architecture. If you upload a zip w/ an example project I will take a look.


Simply try following code it will work

SettingsViewController *settings    =   [[SettingsViewController alloc] init];UINavigationController *navcont = [[UINavigationController alloc] initWithRootViewController:settings];[self presentModalViewController:navcont animated:YES];[settings release];[navcont release];

One need to present the navigation controller in order to have navigation bar on the presented controller


I think I've seen this behavior when presenting a view controller on the wrong VC. Are you calling presentModalViewController on the navigation controller or the individual VC?

Try calling it from the navigationController if you aren't already.

[self.navigationController presentModalViewController:myVC animated:YES];