问题描述
在这里,我们有两种方法来呈现一个简单的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
答案更可取,但是您的问题还是很开放的,希望我能为您提供帮助。
干杯,
多米尼克