gpt4 book ai didi

ios - 在Swift 3中弹出模态

转载 作者:行者123 更新时间:2023-12-01 18:06:15 25 4
gpt4 key购买 nike

我想使用swift实现弹出模式。我必须实现这样,根据用户的响应(是/否)再弹出一个弹出窗口,如何实现呢?
任何帮助都会非常有帮助。

最佳答案

UIAlertController是为此目的而设计的。

        let alertController = UIAlertController(title: "Default AlertController", message: "A standard alert", preferredStyle: .Alert)

let cancelAction = UIAlertAction(title: "No", style: .Cancel) { (action:UIAlertAction!) in
println("you have pressed the No button");
//Call another alert here
}
alertController.addAction(cancelAction)

let OKAction = UIAlertAction(title: "Yes", style: .Default) { (action:UIAlertAction!) in
println("you have pressed Yes button");
//Call another alert here
}
alertController.addAction(OKAction)

self.presentViewController(alertController, animated: true, completion:nil)

关于ios - 在Swift 3中弹出模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43370184/

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