swift UIAlertController实现
2020-06-16 本文已影响0人
江河_ios
iOS8.0以上,苹果建议使用UIAlertController
let alertView = UIAlertController.init(title: "提示", message: "信息", preferredStyle: .alert)
let alert = UIAlertAction.init(title: "确定", style: .destructive) { (UIAlertAction) in
print("确定按钮点击")
}
let cancleAlert = UIAlertAction.init(title: "取消", style: .cancel) { (UIAlertAction) in
print("点击取消按钮")
}
alertView.addAction(cancleAlert)
alertView.addAction(alert);
self.present(alertView, animated: true, completion: nil)