瀏覽代碼

使用系统提示框

jsonwang 3 年之前
父節點
當前提交
42a2fd96fe
共有 1 個文件被更改,包括 18 次插入20 次删除
  1. 18 20
      Introduce/Record/INIntroduceController.swift

+ 18 - 20
Introduce/Record/INIntroduceController.swift

@@ -77,26 +77,24 @@ class INIntroduceController: BFBaseViewController {
     }
 
     override func backBtnClick() {
-        let remindData = BFBaseModel()
-        remindData.summary = "退出将不会保存当前操作"
-        let alertV = BFRemindView(frame: view.bounds)
-        alertV.isBanned = true
-        alertV.confirmBtn.setTitle("不退出", for: .normal)
-        alertV.confirmBtn.titleLabel?.font = UIFont.systemFont(ofSize: 20, weight: .medium)
-        alertV.cancelBtn.setTitle("确认退出", for: .normal)
-        alertV.cancelBtn.titleLabel?.font = UIFont.systemFont(ofSize: 20, weight: .medium)
-        alertV.contentLab.font = UIFont.systemFont(ofSize: 20, weight: .medium)
-        alertV.remindData = remindData
-        alertV.confirmBtn.setTitleColor(UIColor.black, for: .normal)
-        alertV.cancelBtn.setTitleColor(UIColor.red, for: .normal)
-        alertV.contentLab.textColor = .black
-        alertV.remindBlock = { [weak self] item, _ in
-            if item.tag == 1 { // 确定返回到上一层
-                self?.recordScreenVC.backBtnClick()
-                self?.super_back()
-            }
-        }
-        UIApplication.shared.keyWindow?.addSubview(alertV)
+  
+        let alertController = UIAlertController(title: "退出将不会保存当前操作",
+                       message: "", preferredStyle: .alert)
+        let cancelAction = UIAlertAction(title: "不退出", style: .default, handler: nil)
+
+        let okAction = UIAlertAction(title: "确认退出", style: .cancel, handler: {[weak self]
+           action in
+           print("点击了确定")
+           self?.recordScreenVC.backBtnClick()
+            self?.super_back()
+        })
+        okAction.setValue(UIColor.red, forKey:"titleTextColor")
+
+        alertController.addAction(okAction)
+        alertController.addAction(cancelAction)
+
+        self.present(alertController, animated: true, completion: nil)
+        
     }
 
     private func super_back() {