我的应用需要在不同时间向用户显示一些信息。 我决定使用 AlertControllers 但我不能同时显示两个 Alert Controllers。 因此我需要知道是否显示了警报 Controller ,关闭它并打开另一个。
到目前为止我已经做到了。我正在使用 self.presentedViewController
检查是否显示了 AlertController。但我不知道如何关闭它。
我试过
self.presentedViewController?.removeFromParentViewController()
和
self.presentedViewController?.delete(self.presentedViewController)
运气不好。有人可以帮助我吗?谢谢
最佳答案
您可以在呈现的 AlertController
上调用 dismissViewControllerAnimated
。如果需要,您可以在 completion
block 中显示下一个。
self.alertViewController?.dismissViewControllerAnimated(true, completion: {
})
关于ios - 如果调用另一个 Alert Controller 以显示,则删除 Alert Controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27964236/