swift UIAlertController教程

在iOS8中,UIAlertView与UIActionSheet都已经退休,取而代之的是UIAlertController!
它的使用示范如下:
//弹出一个警告框,标题是“提示”,信息是“我的博客:oaapi.com”,然后有两个按钮:OK,Cancel。

var alert UIAlertController(titile:"提示", message:"我的博客:oaapi.com", completion:nil)
var actionOK = UIAlertAction(title:"OK", style:.Default, hander:nil)
var actionCancel = UIAlertAction(title:"Cancel", style:.Default, hander:nil)
alert.addAction(actionOK)
alert.addAction(actionCancel)
self.presentViewController(alert, animated:true, completion:nil)

原文地址:https://www.cnblogs.com/adjk/p/4936656.html