如何将现有的 UIViewController(使用presentModalViewController 呈现)添加到 UINavigationController?
当用户点击按钮时,需要推送我的详细 View 的新副本。 (换句话说,pushViewController 在 UINavigationController 中以模态方式显示 pushViewController)。
启用此功能的最简单方法?
最佳答案
如何创建模态视图 Controller ?只需将 Controller 包装到 UINavigationController 中
假设您的模态代码如下所示:
MyExampleViewController *vc = [[[MyExampleViewController alloc] initWithNibName:@"MyExample" bundle:nil] autorelease];
[self presentModalViewController:vc animated:YES];
然后改成这样:
MyExampleViewController *vc = [[[MyExampleViewController alloc] initWithNibName:@"MyExample" bundle:nil] autorelease];
UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease];
[self presentModalViewController:navController animated:YES];
关于iphone - 将 UINavigationController 添加到现有的 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4957878/