我需要一点导航控制器问题的帮助.
我有navigationController4 ViewControllers推.推送的最后一个vc进一步提供了ViewController模态.模态ViewController提出了一个ActionSheet.根据用户的回答,我要么ViewController仅解除模态,要么我想回到根目录ViewController.
在ViewController提出的模态中,我有:
- (void) dismissGameReport
{
[[self delegate] GameReportModalWillBeDismissed:modalToPopToRoot];
}
Run Code Online (Sandbox Code Playgroud)
在最后ViewController推入navigationController堆栈我有:
- (void)GameReportModalWillBeDismissed: (BOOL)popToRoot;
{
if (popToRoot)
{
[self.navigationController popToRootViewControllerAnimated:NO];
}
else
{
[self dismissModalViewControllerAnimated:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
解雇模态视图控制器工作正常.然而,
[self.navigationController popToRootViewControllerAnimated:NO];
Run Code Online (Sandbox Code Playgroud)
不会导致root ViewController显示其视图.添加一些日志信息我看到在self.navigationController正确弹出到堆栈的消息之后,执行依次继续.屏幕仍然显示模态ViewController的视图.
作为一种解决方法,我尝试总是解雇模态视图控制器,并在ViewWillAppear方法中有popToRootAnimated消息.没有不同.仍会弹出一堆控制器,但屏幕会继续显示我的模态视图控制器的视图,并继续按顺序执行.
有人可以帮帮我吗?