Sfoglia il codice sorgente

撤销按钮置灰

harry 3 anni fa
parent
commit
a0e162b1ae

+ 13 - 3
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -88,8 +88,17 @@ public class BFRecordScreenController: BFBaseViewController {
     // MARK: 行为参数
     
     var movieIsProcessing = false
-    var events = [WithDrawModel]() // 行为记录,方便撤销
-    var isDragingProgressSlder: Bool = false // 是否在拖动进度条
+    
+    // 行为记录,方便撤销
+    var events = [WithDrawModel]() {
+        didSet {
+            withDrawBtn.isEnabled = (events.count != 0)
+        }
+    }
+    
+    // 是否在拖动进度条
+    var isDragingProgressSlder: Bool = false
+    
     var isStopAtRecordRange = -1
     
     // 保存识别出来的字幕信息,用于回放,和合成使用
@@ -181,7 +190,8 @@ public class BFRecordScreenController: BFBaseViewController {
         btn.setImage(imageInRecordScreenKit(by: "withdraw_h"), for: .highlighted)
         btn.setTitle("回退", for: .normal)
         btn.setTitleColor(.white, for: .normal)
-        btn.setTitleColor(.gray, for: .highlighted)
+        btn.setTitleColor(.lightGray, for: .disabled)
+        btn.isEnabled = false
         btn.titleLabel?.font = UIFont.systemFont(ofSize: 12)
         btn.contentVerticalAlignment = UIControl.ContentVerticalAlignment.center
         btn.addTarget(self, action: #selector(withdrawAction), for: .touchUpInside)