我有一个 TableView Controller A,它向 View Controller B 执行推送转场。B 然后向 View Controller C 执行模态转场。我在 C 上有一个按钮,需要导致解雇C(按照说明是模态的)和 B 的弹出,以便我们返回到 A。在 C 中,我检测到按钮按下并使用委托(delegate)回调 B,然后使用它关闭模态视图 Controller C :
[sender dismissViewControllerAnimated:NO completion:nil];
B 然后使用委托(delegate)回调 A,A 使用以下命令从堆栈中弹出 B:
[self.navigationController popViewControllerAnimated:YES];
现在这一切都正常了,除了一个非常烦人的事实,即我在所有这一切期间短暂地看到了 B,而我希望能够从 C 直接“弹出”回到 A 而根本看不到 B,无论多么短暂。我已经为上面的动画参数尝试了 YES/NO 的组合,也尝试了 popToRootViewControllerAnimated,但没有运气:-(
有没有人有什么想法?
最佳答案
我拼凑了一个快速项目,使用这段代码似乎对我来说工作正常:
[self dismissViewControllerAnimated:YES completion:nil];
// Just a coincidence that this is the presenting VC rather than a regular UIViewController I think.
UINavigationController *navController = (UINavigationController *)self.presentingViewController;
[navController popViewControllerAnimated:NO];
这是 Github 上的示例项目:https://github.com/MaxGabriel/iOSNavigationFlow
关于objective-c - 中间 View Controller 在关闭模态视图然后弹出 View Controller 后短暂显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13899164/