是否可以在ModalPopup中创建UINavigationController?

alo*_*loo 1 iphone cocoa uiviewcontroller uinavigationcontroller

嗨,我有一个我正在弹出的modalViewController

[self presentModalViewController:myController animated:YES];
Run Code Online (Sandbox Code Playgroud)

我在myController中发生了一个事件,我希望将另一个控制器推送到导航堆栈ON TOP OF myController(它再次以模态方式呈现).我怎样才能做到这一点?

我在myController中尝试了以下内容:

UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:self];
  NewController* n = [[NewController alloc] init];
  [navController pushViewController:n animated:YES];
  [n release];
Run Code Online (Sandbox Code Playgroud)

但这不起作用....

EEE*_*EEE 8

首先创建你的第二个modalViewController

NewController* new = [[NewController alloc] init];
Run Code Online (Sandbox Code Playgroud)

然后像这样创建navigaitonController

UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController: new];
navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
Run Code Online (Sandbox Code Playgroud)

然后将您的navigationController呈现为模态视图控制器

[self presentModalViewController:navigationController animated:YES];
[navigationController release];
Run Code Online (Sandbox Code Playgroud)

干得好.希望能帮助到你.