【发布时间】:2015-01-25 14:04:40
【问题描述】:
我想创建以下UIAlertAction:
@IBAction func buttonUpgrade(sender: AnyObject) {
let alertController = UIAlertController(title: "Title",
message: "Message",
preferredStyle: UIAlertControllerStyle.Alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel) { (action) in
// ...
}
alertController.addAction(cancelAction)
}
我知道UIAlertController 被初始化为title、message,以及它更喜欢显示为警报还是操作表。
按下按钮时,我想显示警报,但alert.show() 不起作用。为什么我的代码不起作用?
【问题讨论】:
标签: ios swift uialertcontroller