如何在 Objective C 中显示另一个之前关闭一个呈现的 UIAlertController
How to dismiss a presented UIAlertController before displaying another in Objective C
我想在展示新的 UIAlertController
之前关闭之前展示的 UIAlertControllers
。我需要从 AppDelegate
执行此操作。如何才能做到这一点。欢迎所有建议。
您可以找到最上面显示的视图控制器并检查它是否是 UIAlertController
。如果是,那么您可以在其上调用 dismissViewControllerAnimated:
。所有这些都可以非常简单地从应用程序委托中完成。
这应该有帮助,您可以将其扩展到所有视图控制器和视图的循环:
[[UIApplication sharedApplication].keyWindow.rootViewController.view endEditing:YES];
我想在展示新的 UIAlertController
之前关闭之前展示的 UIAlertControllers
。我需要从 AppDelegate
执行此操作。如何才能做到这一点。欢迎所有建议。
您可以找到最上面显示的视图控制器并检查它是否是 UIAlertController
。如果是,那么您可以在其上调用 dismissViewControllerAnimated:
。所有这些都可以非常简单地从应用程序委托中完成。
这应该有帮助,您可以将其扩展到所有视图控制器和视图的循环:
[[UIApplication sharedApplication].keyWindow.rootViewController.view endEditing:YES];