【发布时间】:2017-04-12 12:55:32
【问题描述】:
我想使用 swift 实现一个弹出模式。我必须实现这样我才能根据用户点击的响应(是/否)再弹出一个。我该如何实现呢? 任何帮助都会非常有帮助。
【问题讨论】:
-
检查这个库可能有帮助github.com/MarioIannotta/MIBlurPopup
标签: ios swift3 mobile-application
我想使用 swift 实现一个弹出模式。我必须实现这样我才能根据用户点击的响应(是/否)再弹出一个。我该如何实现呢? 任何帮助都会非常有帮助。
【问题讨论】:
标签: ios swift3 mobile-application
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)
【讨论】: