下面以清空缓存简单记录一下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
}