objective-c - 中间 View Controller 在关闭模态视图然后弹出 View Controller 后短暂显示

标签 objective-c ios modal-dialog popviewcontrolleranimated

我有一个 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/

相关文章:

angular - 在 Typescript/Angular2 中显示 bootbox 警报?

iphone - 我想在一个 IBAction 中启用 ScrollView ,然后在该操作之前我想禁用它。我该如何执行此操作?

objective-c - 如何对 NSComboBox 内容进行排序

iphone - objective c 类方法返回值,分配给弱/强属性

matlab - 非模态 questdlg.m 提示

javascript - onClick 激活所有其他 onClick 事件

ios - 如何从我的 native ios 应用程序中登录 Twitter 帐户

javascript - 基于多个 ScrollView(s) 为单个 View 设置动画

ios - 本地化和警告 : Multiple build commands

ios - 如何在 Swift 中隐藏 UITableView 部分?