Pārlūkot izejas kodu

代码优化(iOS) - 代理共用

dinglingui 1 gadu atpakaļ
vecāks
revīzija
16bf919ead

+ 6 - 6
ComPDFKit_Tools/ComPDFKit_Tools/Common/Views/PDFView/PDFListView/CPDFListView+Form.m

@@ -420,8 +420,8 @@
     
     [self updateFormScrollEnabled];
     if([widgetAnnotation isKindOfClass:[CPDFChoiceWidgetAnnotation class]] || ([widgetAnnotation isKindOfClass:[CPDFButtonWidgetAnnotation class]] && isPushButton)) {
-        if(self.performDelegate && [self.performDelegate respondsToSelector:@selector(PDFListViewEditWidget:forAnnotation:)]) {
-            [self.performDelegate PDFListViewEditWidget:self forAnnotation:self.activeAnnotation];
+        if(self.performDelegate && [self.performDelegate respondsToSelector:@selector(PDFListViewEditNote:forAnnotation:)]) {
+            [self.performDelegate PDFListViewEditNote:self forAnnotation:self.activeAnnotation];
         }
     } else {
         [self showMenuForWidgetAnnotation:widgetAnnotation];
@@ -524,14 +524,14 @@
 #pragma mark - Action
 
 - (void)menuItemClick_Option:(UIMenuItem *)menuItem {
-    if(self.performDelegate && [self.performDelegate respondsToSelector:@selector(PDFListViewEditWidget:forAnnotation:)]) {
-        [self.performDelegate PDFListViewEditWidget:self forAnnotation:self.activeAnnotation];
+    if(self.performDelegate && [self.performDelegate respondsToSelector:@selector(PDFListViewEditNote:forAnnotation:)]) {
+        [self.performDelegate PDFListViewEditNote:self forAnnotation:self.activeAnnotation];
     }
 }
 
 - (void)menuItemClick_FormEdit:(UIMenuItem *)menuItem {
-    if(self.performDelegate && [self.performDelegate respondsToSelector:@selector(PDFListViewEditWidget:forAnnotation:)]) {
-        [self.performDelegate PDFListViewEditWidget:self forAnnotation:self.activeAnnotation];
+    if(self.performDelegate && [self.performDelegate respondsToSelector:@selector(PDFListViewEditNote:forAnnotation:)]) {
+        [self.performDelegate PDFListViewEditNote:self forAnnotation:self.activeAnnotation];
     }
 }
 

+ 0 - 2
ComPDFKit_Tools/ComPDFKit_Tools/Common/Views/PDFView/PDFListView/CPDFListView.h

@@ -73,8 +73,6 @@ extern NSNotificationName const CPDFListViewAnnotationsOperationChangeNotificati
 
 - (void)PDFListViewEditNote:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation;
 
-- (void)PDFListViewEditWidget:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation;
-
 - (void)PDFListViewEditProperties:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation;
 
 - (void)PDFListViewPerformTouchEnded:(CPDFListView *)pdfListView;

+ 3 - 2
Forms/Forms/CPDFViewController.m

@@ -291,8 +291,9 @@
     }
 }
 
-- (void)PDFListViewEditWidget:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
-    [self.formBar buttonItemClicked_openOption:annotation];
+- (void)PDFListViewEditNote:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
+    if([annotation isKindOfClass:[CPDFWidgetAnnotation class]])
+        [self.formBar buttonItemClicked_openOption:annotation];
 }
 
 - (void)PDFListViewEditProperties:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {

+ 2 - 4
PDFViewer/PDFViewer/CPDFViewController.m

@@ -474,6 +474,8 @@
 - (void)PDFListViewEditNote:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
     if([annotation isKindOfClass:[CPDFLinkAnnotation class]]) {
         [self.annotationBar buttonItemClicked_openAnnotation:self.titleButton];
+    } else if ([annotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
+        [self.formBar buttonItemClicked_openOption:annotation];
     } else {
         CGRect rect = [self.pdfListView convertRect:annotation.bounds fromPage:annotation.page];
         CPDFNoteOpenViewController *noteVC = [[CPDFNoteOpenViewController alloc]initWithAnnotation:annotation];
@@ -736,10 +738,6 @@
     }
 }
 
-- (void)PDFListViewEditWidget:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
-    [self.formBar buttonItemClicked_openOption:annotation];
-}
-
 #pragma mark - CPDFToolsViewControllerDelegate
 
 - (void)CPDFToolsViewControllerDismiss:(CPDFToolsViewController *) viewController selectItemAtIndex:(CToolModel)selectIndex {