let alertTitle = "TITLE"
let alertMessage = "MESSAGE"
let alertOkButtonText = "确定"
let alterCancelButtonText = "取消"
let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .Alert)
//添加的按钮 用UIAlertAction
let actionOk = UIAlertAction(title: alertOkButtonText, style: .Default, handler: { (UIAlertAction) in
//to do something here
})
let actionCancel = UIAlertAction (title: alterCancelButtonText, style: .Default, handler: { (UIAlertAction) in
self.dismissViewControllerAnimated(true, completion: nil)
})
alertController.addAction(actionOk)
alertController.addAction(actionCancel)
self.presentViewController(alertController, animated: true, completion: nil)
![]()