Root view controllers and modal dialogs
- by Tony
In a custom UIViewController, if I have a member UINavigationController that I initialize with self as the root view, like this:
navController = [[UINavigationController alloc] initWithRootViewController:self];
then presenting a modal dialog does not hide the tab bar at the bottom of the screen. The result is that if the user switches to a different tab while a modal dialog is displayed, when they pop back to the tab that was displaying a modal dialog then subsequent calls to presentModalViewController do not display a modal dialog at all, even if I call dismissModalViewControllerAnimated as a result of the tab switch.
If I initialize the UINavigationController with out setting self as the root controller,
navigationController = [[UINavigationController alloc] init];
then the tab bar is hidden as expected. I've changed things in my program so that this isn't really an issue for me anymore, but I'm not sure that I understand why this is happening. Is it considered bad practice to have a navigation controller with self as the root, if the nav controller is going to be displaying modal dialogs?