gpt4 book ai didi

ios - 如何在呈现 Controller 的顶部显示 UIAlertController

转载 作者:行者123 更新时间:2023-11-28 07:01:38 25 4
gpt4 key购买 nike

我有顶 View Controller 正在呈现,我想显示警报 Controller 但它没有显示。有什么办法吗?

var appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController?.presentViewController(alert, animated: true, completion: nil)

最佳答案

( objective-C )

UIAlertController *alertVC = [UIAlertController
alertControllerWithTitle:@"myTitle" message:@"myMessage"
preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction
actionWithTitle:@"Ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction* action) {
[alertVC dismissViewControllerAnimated:YES completion:nil];
}
]];
[self presentViewController:alertVC animated:YES completion:nil];

关于ios - 如何在呈现 Controller 的顶部显示 UIAlertController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31877236/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com