Ver código fonte

【注释】修复选中工具栏,数据为空

wanjun 10 meses atrás
pai
commit
01b4f7d4b7

+ 5 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.swift

@@ -172,20 +172,18 @@ import Cocoa
     
     func reloadData() {
         guard let fillColorPickerView = fillColorPickerView else { return }
-        guard let annotation = self.annotation else { return }
         if annotations.count > 0 {
-            if let presetValue = annotation.buttonWidgetStateString() {
-                annotation.setButtonWidgetStateString(presetValue)
+            if let presetValue = annotation?.buttonWidgetStateString() {
+                annotation?.setButtonWidgetStateString(presetValue)
             }
             var opacity: CGFloat = 1
-            let color = annotation.backgroundColor
+            let color = annotation?.backgroundColor
             if color != nil {
                 color!.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
             }
 
-            let fontColor = annotation.fontColor
-            let isTextWidget = (annotation.isKind(of: CPDFTextWidgetAnnotation.self))
-            if isTextWidget {
+            let fontColor = annotation?.fontColor
+            if let isTextWidget = (annotation?.isKind(of: CPDFTextWidgetAnnotation.self)), isTextWidget {
                 fillColorPickerView.color = color
                 colorPickerView.color = fontColor