下面以清空緩存簡(jiǎn)單記錄一下UIAlertController 的使用
let alert = UIAlertController(title: "清除緩存", message: "", preferredStyle: UIAlertControllerStyle.alert);
let alertConfirm = UIAlertAction(title: "確定", style: UIAlertActionStyle.default) { (alertConfirm) -> Void in
XPToast.show(withText: "清除成功");
}
alert.addAction(alertConfirm)
let cancle = UIAlertAction(title: "取消", style: UIAlertActionStyle.cancel) { (cancle) -> Void in
}
alert.addAction(cancle)
// 提示框彈出
self.present(alert, animated: true) { () -> Void in
}