Browse Source

【2025】【OCR】编辑OCR 顶部提示框逻辑调整

lizhe 2 months ago
parent
commit
22db7d41a1

+ 2 - 3
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -2872,7 +2872,6 @@ extension KMMainViewController {
     
     func showOCREditAlert() {
         DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) { [unowned self] in
-            alertTipViewController.isShowOCRAlert = true
             alertTipViewController.showInView(listView)
             alertTipViewController.reloadOCRAlertUI()
             alertTipViewController.reloadAlertUIFrame()
@@ -2884,9 +2883,9 @@ extension KMMainViewController {
     }
     
     func closeOCREditAlert() {
-        alertTipViewController.isShowOCRAlert = false
+        guard let view = alertTipViewController.OCRComponentAlert else { return }
         alertTipViewController.reloadOCRAlertUI()
-        //        alertTipViewController.reloadAlertUIFrame()
+        alertTipViewController.reloadAlertUIFrame()
     }
     
     func showOCRToolAlert(_ string: String) {

+ 8 - 11
PDF Office/PDF Master/KMClass/PDFListView/ViewController/KMNAlertTipViewController.swift

@@ -271,8 +271,7 @@ class KMNAlertTipViewController: KMNBaseViewController {
      }
     
     public func reloadOCRAlertUI() {
-        if isShowOCRAlert == true {
-            OCRComponentAlert.isHidden = false
+        if isShowOCRAlert == true && self.listView?.toolMode == .CEditPDFToolMode {
             var isContainsImagePage = false
             for i in 0..<(listView?.document?.pageCount ?? 0) {
                 guard i < listView?.document?.pageCount ?? 0 else { continue }
@@ -291,16 +290,14 @@ class KMNAlertTipViewController: KMNBaseViewController {
                 }
                 OCRComponentAlert.reloadData()
             } else {
-//                if OCRComponentAlert.superview != nil {
-//                    OCRComponentAlert.removeFromSuperview()
-//                }
-                OCRComponentAlert.isHidden = true
+                if OCRComponentAlert.superview != nil {
+                    OCRComponentAlert.removeFromSuperview()
+                }
             }
         } else {
-//            if OCRComponentAlert.superview != nil {
-//                OCRComponentAlert.removeFromSuperview()
-//            }
-//            OCRComponentAlert.isHidden = true
+            if OCRComponentAlert.superview != nil {
+                OCRComponentAlert.removeFromSuperview()
+            }
         }
      }
 
@@ -336,7 +333,7 @@ class KMNAlertTipViewController: KMNBaseViewController {
             alertHeight += 32.0
         }
         
-        if OCRComponentAlert.superview != nil && OCRComponentAlert.isHidden == false {
+        if OCRComponentAlert.superview != nil {
             if alertHeight > 0 {
                 alertHeight += 1
             }