Bläddra i källkod

[批量] - 添加页眉页脚菜单选项是否可点击

liujiajie 10 månader sedan
förälder
incheckning
8c5dac5061

+ 14 - 10
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/VC/KMBatchOperateAddHeaderFooterViewController.swift

@@ -547,16 +547,7 @@ class KMBatchOperateAddHeaderFooterViewController: KMBatchOperateBaseViewControl
         reloadTable()
         postNotification()
     }
-    func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
-        let action = menuItem.action
-        if action == #selector(buttonItemClick_CleanAll(_:)) {
-            if (self.isBates && KMHeaderFooterManager.defaultManager.onlyBatesObjects.count < 1) || (!self.isBates && KMHeaderFooterManager.defaultManager.onlyHeaderFooterObjects.count < 1){
-                return false
-            }
-            return true
-        }
-        return true
-    }
+   
     func headerFooterInterfaceSelectHeaderFooter(headerFooter: KMHeaderFooterObject) {
         self.tableView.reloadData()
         if let index = KMHeaderFooterManager.defaultManager.onlyHeaderFooterObjects.firstIndex(of: headerFooter) {
@@ -664,3 +655,16 @@ class KMBatchOperateAddHeaderFooterViewController: KMBatchOperateBaseViewControl
         NotificationCenter.default.post(name: NSNotification.Name(rawValue: kNeedChangePageRangeNotification), object: nil)
     }
 }
+
+extension KMBatchOperateAddHeaderFooterViewController: NSMenuDelegate, NSMenuItemValidation{
+    func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
+        let action = menuItem.action
+        if action == #selector(buttonItemClick_CleanAll(_:)) {
+            if (self.isBates && KMHeaderFooterManager.defaultManager.onlyBatesObjects.count < 1) || (!self.isBates && KMHeaderFooterManager.defaultManager.onlyHeaderFooterObjects.count < 1){
+                return false
+            }
+            return true
+        }
+        return true
+    }
+}