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)

posted on 2015-11-04 17:26  子墨'  阅读(234)  评论(0编辑  收藏  举报

导航