【发布时间】:2014-12-15 10:16:20
【问题描述】:
我正在使用 Objective C 开发 iPhone 应用程序。因为我需要一次关闭两个 UIViewController,所以我使用以下代码:
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
此代码在 iOS6 和 iOS7 中运行良好,但在 iOS8 中无法运行。我已经使用断点进行了检查,我的 ViewController viewDidLoad 和 viewWillAppear 方法正在调用,但我的视图根本没有加载,所以作为输出,我得到的是空白屏幕。谁能帮我,对于iOS8,我该如何解决这个问题,我是否需要使用presentingViewController而不是presentingViewController?
【问题讨论】:
-
如果有多个 vc 呈现,我会在你想解散的 VC 中添加一个通知观察者并发送通知要求它离开。
-
感谢@Horst 的回复。但根据我的要求,需要关闭两个 ViewController。
-
然后向两个 VC 添加观察者
标签: iphone ios8 presentmodalviewcontroller presentviewcontroller