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