// 方法1
let alertSheet = UIActionSheet(title: alertTitle, delegate: nil, cancelButtonTitle: alertOK, destructiveButtonTitle: alertCancel)
alertSheet.showInView(self.view)
// 方法2
// 实例化时添加代理对象,同时注意添加协议
let alertSheet = UIActionSheet(title: alertTitle, delegate: self, cancelButtonTitle: alertOK, destructiveButtonTitle: alertCancel, otherButtonTitles: "警告", "提示", "通告")
alertSheet.showInView(self.view)
// 添加协议
class ViewController: UIViewController, UIActionSheetDelegate {
override func viewDidLoad() {
...
}
...
}
// 代理方法