Переглянути джерело

【综合】开启文档、关闭文档卡顿问题优化

tangchao 6 місяців тому
батько
коміт
0d0fe52413

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarItemView.swift

@@ -34,7 +34,7 @@ extension KMToolbarItemView {
             return self._itemIdentifier
         }
     }
-    var pdfView : CPDFListView = CPDFListView()
+    weak var pdfView: CPDFListView?
 
     lazy var clickButton: KMToolbarClickButton = {
         let view = KMToolbarClickButton()
@@ -831,11 +831,11 @@ extension KMToolbarItemView: KMCustomButtonPopMenuViewControllerDelegate, KMCust
     func itemEnable(at index: Int) -> Bool {
         if self.itemIdentifier == KMToolbarToolFormAlignIdentifier {
             if index <= 6 {
-                if self.pdfView.activeAnnotations.count >= 2 {
+                if let cnt = self.pdfView?.activeAnnotations.count, cnt >= 2 {
                     return true
                 }
             } else {
-                if self.pdfView.activeAnnotations.count >= 3 {
+                if let cnt = self.pdfView?.activeAnnotations.count, cnt >= 3 {
                     return true
                 }
             }