iOS呈现的UINavigationController在执行popViewController后被解雇

时间:2013-08-27 14:36:34

标签: ios objective-c uiviewcontroller uinavigationcontroller

在我的应用中,我提供UINavigationController模式,UIViewController为其rootViewController。我是以表格风格做的。我添加了第二个UIViewController,这也是表单样式,我可以推动它。但是,当第二个popViewController弹出到第一个UIViewcontroller后执行UIViewController操作时,整个模态显示的if(!welcomeScreenAlreadyPresented) { welcomeScreenViewController = [[WAWelcomeViewController alloc]init]; } welcomeScreenNavController = [[UINavigationController alloc]initWithRootViewController:welcomeScreenViewController]; [welcomeScreenNavController setModalTransitionStyle: UIModalTransitionStyleCrossDissolve]; [welcomeScreenNavController setModalPresentationStyle:UIModalPresentationFormSheet]; [welcomeScreenNavController setNavigationBarHidden:YES animated:NO]; [self.navigationController presentViewController:welcomeScreenNavController animated:YES completion:nil]; 将被解除。但是我不执行任何解雇,并且解雇功能也不会被意外触发。

任何想法为什么会发生?

此致

佐利

编辑:

这就是我用navcontroller呈现模态viewcontrollers的方式:

registerViewController = [[WARegisterViewController alloc]init];

[self.navigationController pushViewController:registerViewController animated:YES];

这就是我在WAWelcomeViewController.m

中的导航方式
[self.navigationController popViewControllerAnimated:YES];

在WARegisterViewController.m中,这就是我回弹的方式

{{1}}

1 个答案:

答案 0 :(得分:1)

您需要做的是将想要推送到另一个UINavigationController的viewController。

registerViewController = [[WARegisterViewController alloc]init];
UINavigationController *modalNavigationController = [[UINavigationController alloc] initWithRootViewController:registerViewController]; // autorelease if you are not using ARC

[self presentViewController:navController animated:YES completion:^{}];

您可能希望将modalNavigationController添加为属性,以便稍后调用popViewControllerAnimated: