我在网上搜索了很多这样的问题,但是我找不到答案,好像每个人都在使用 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/