如何在模式呈现的UITableViewController上显示UINavigationBar?

时间:2010-07-18 14:18:39

标签: iphone uinavigationcontroller modal-dialog uinavigationbar

如果您有一个UINavigationController的UIViewController以模态方式呈现UITableViewController(TVC),TVC是否有办法显示其parentViewController的UINavigationBar?或者,我应该为模态TVC创建一个新的UINavigationBar,项目,按钮等吗?

1 个答案:

答案 0 :(得分:2)

我只是在你出示你的模态之前实例化一个UINavigationController。

YourViewController *modalViewController = [[YourViewController alloc] initWithNibName:@"foo" bundle:nil]
UINavigationController *tmpNavController = [[UINavigationController alloc] initWithRootViewController:modalViewController];
[modalViewController release];
[self.navigationController presentModalViewController:tmpNavController animated:YES];
[tmpNavController release];

这只是背后的信息 - 我不会复制并粘贴该代码而无需仔细检查!