是否存在从窗口根目录呈现UIAlertController的合法案例?

问题描述

在这里,我们有两种方法来呈现一个简单的UIAlertController:

.\config.cmd --proxyurl http://... --proxyusername ... --proxypassword ... --url https://... --auth integrated --pool ... --agent vsts-agent-win-x64-2.169.1 --runAsService --windowslogonAccount ... --windowslogonPassword ...

当然,当遵循MVC之类的体系结构时,我们不希望模型中的某些内容呈现视图(或者在这种情况下,steps: - task: ms-vsclient.google-play.google-play-release-bundle.GooglePlayReleaseBundle@3 displayName: 'Release app.apk' inputs: authType: JsonFile serviceAccountKey: '....json' applicationId: ... bundleFile: '$(System.DefaultWorkingDirectory)/.../app.apk' track: alpha changeLogFile: '$(System.DefaultWorkingDirectory)/.../app.apk' 充当// In the context of a UIViewController let alert = UIAlertController(title: "title",message: "message",preferredStyle: UIAlertController.Style.alert) self.present(alert,animated: true,completion: nil) // Anywhere in the program let alert = UIAlertController(title: "title",preferredStyle: UIAlertController.Style.alert) UIApplication.shared.keyWindow?.rootViewController?.present(alert,completion: nil) )。我试图通过第二种方式来考虑好的用例,但是遇到了一些困难。也许现在可以支持多个UIAlertController了吗?

解决方法

举例说明我几年前使用的应用程序:

我们使用了多个UIWindow实例,就像您已经提到的那样。
假设一个窗口(window1)中的事件导致必须在另一个窗口(window2)中显示警报。

window2不知道UIView中当前显示了哪个window1,因此不需要关心。相反,如果只是发出事件/通知/被捕获的事件window1,则就像您在示例中所做的那样,仅显示其rootViewController中的警报。

这比one and only答案更可取,但是您的问题还是很开放的,希望我能为您提供帮助。

干杯,
多米尼克

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...