0
votes

When I present a view controller modally:

// Display the nav controller modally.

[self presentModalViewController:theNavController animated:YES];

The navigation bar is covered up the view the pops up! How can I get the navigation bar to not get covered up??

Thanks in advance!

2
Position the view that is covering it below the navigation bar. It covers it because the views share the same superview and probably both have a y-origin of 0.Matt
Either add a navigationBar or wrap the presented controller in a UINavigationControllerPaul.s
Can you explain with code? Thanks!waylonion

2 Answers

3
votes

The answers can be found at iPhone: Show modal UITableViewController with Navigation bar and UINavigationBar refuses to show in Modal View Controller!

You need to wrap the UIViewController in a UINavigationController, and then present the navigation controller:

AccountViewController* accountViewController = [[AccountViewController alloc] initWithNibName:@"AccountView" bundle:nil]; 
... 
// Initialize properties of accountViewController 
... 
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:accountViewController]; 
[self.navigationController presentModalViewController:navController animated:YES]; 
[navController release]; 
[accountViewController release]; 
1
votes
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewContorller:someViewController];
[self presentModalViewController:navController animated:YES];