我想使用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/