当我以模态方式呈现视图控制器时:
//以模态方式显示导航控制器。
[self presentModalViewController:theNavController animated:YES];
导航栏被弹出的视图遮住了! 如何让导航栏不被遮盖?
提前致谢!
答案 0 :(得分:3)
答案可在iPhone: Show modal UITableViewController with Navigation bar找到 和 UINavigationBar refuses to show in Modal View Controller!
您需要将UIViewController
包裹在UINavigationController
中,然后展示导航控制器:
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 :(得分:1)
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewContorller:someViewController];
[self presentModalViewController:navController animated:YES];