ios - 关闭两个 UIViewController

标签 ios uiviewcontroller

我在网上搜索了很多这样的问题,但是我找不到答案,好像每个人都在使用 navigationcontroller 而我只是在使用 uiviewcontroller 我正在展示一个像这样的 UIViewcntroller:

[self presentViewController:controller animated:NO completion:nil];

当我在使用之前释放 Controller 以显示 Controller 时:

[self dismissViewControllerAnimated:NO completion:nil];

我所拥有的是 C 中的 A->B->C 我需要关闭 C 和 B UIViewControllers,我该如何实现?

最佳答案

你可以试试这个方法:

 [self.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil];

C 你想返回 View 的地方只需输入这行,它将直接引导你到 A

您还可以使用 NSNotificationCenter

希望对您有所帮助。

关于ios - 关闭两个 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19674563/

相关文章:

iphone - 是否有任何工具可以浏览您应用程序的 iCloud 数据?

ios - 无法使用 Swift 在 Xcode 中使用 Parse 1.7.2 和 Facebook SDK 4.1 创建新用户

ios - Swift:变量获取以错误顺序分配的值

ios - 确定 viewWillAppear 是来自打开应用程序还是取消选择模态

swift - UIViewController 的输入 View 在第一次时自动打开

uiviewcontroller - 解雇ModalViewControllerAnimated : will not dismiss the page?

ios - 在选项卡之间滑动时使 Capsule() 移动 -matchedGeometryEffect

iphone - iOS Retina 显示屏的奇怪调整大小和分辨率

iphone - 为什么我的新 View Controller 没有出现?

iphone - 用于具有转换的非导航应用程序的 View Controller /NIB 架构?