且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Swift UIAlertView中显示警报不起作用

更新时间:2022-02-06 07:17:03

您应使用 UIAlertController

UIAlertView 已过时。

您可以使用以下代码显示警报:

You can show an alert with this code:

var alert = UIAlertController(title: "Alert", message: "test", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)