Modal在Swift中弹出3
答
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)
+0
我知道这个报告控制,但情况是我必须做出一个自定义模式弹出,我怎么能实现定制弹出? – victorious
+1
简单的做法是,将UIView放入透明背景。在其上添加一个视图,用作弹出窗口。现在开始设计UIView。 –
+0
好的,这似乎是一个更好的方法。我一定会实现。谢谢:) – victorious
检查这个库可以帮助它https://github.com/MarioIannotta/MIBlurPopup –