浏览代码

PDFAnnotation(iOS)-修改注释属性面板的修改规则

yangliuhua 1 年之前
父节点
当前提交
c048f93940

+ 2 - 2
Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/CPDFViewController.m

@@ -287,7 +287,7 @@
 
 - (void)PDFListViewEditNote:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
     if([annotation isKindOfClass:[CPDFLinkAnnotation class]]) {
-        [self.annotationBar buttonItemClicked_open:self.titleButton];
+        [self.annotationBar buttonItemClicked_openAnnotation:self.titleButton];
     } else {
         CGRect rect = [self.pdfListView convertRect:annotation.bounds fromPage:annotation.page];
         CPDFNoteOpenViewController *noteVC = [[CPDFNoteOpenViewController alloc]initWithAnnotation:annotation];
@@ -381,7 +381,7 @@
 }
 
 - (void)PDFListViewEditProperties:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
-    [self.annotationBar buttonItemClicked_open:self.titleButton];
+    [self.annotationBar buttonItemClicked_openAnnotation:self.titleButton];
 }
 
 #pragma mark - CPDFBOTAViewControllerDelegate

+ 2 - 2
ComPDFKit/ComPDFKit/CPDFViewController.m

@@ -518,7 +518,7 @@
 
 - (void)PDFListViewEditNote:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
     if([annotation isKindOfClass:[CPDFLinkAnnotation class]]) {
-        [self.annotationBar buttonItemClicked_open:self.titleButton];
+        [self.annotationBar buttonItemClicked_openAnnotation:self.titleButton];
     } else {
         CGRect rect = [self.pdfListView convertRect:annotation.bounds fromPage:annotation.page];
         CPDFNoteOpenViewController *noteVC = [[CPDFNoteOpenViewController alloc]initWithAnnotation:annotation];
@@ -632,7 +632,7 @@
 
 - (void)PDFListViewEditProperties:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
     if(CToolModelAnnotation == self.pdfListView.toolModel){
-        [self.annotationBar buttonItemClicked_open:self.titleButton];
+        [self.annotationBar buttonItemClicked_openAnnotation:self.titleButton];
     }else if(CToolModelForm == self.pdfListView.toolModel) {
         [self.formBar buttonItemClicked_open:annotation];
     }

+ 6 - 2
compdfkit-tools/compdfkit-tools/Common/Controls/BOTA/CPDFBOTAViewController.m

@@ -116,8 +116,12 @@
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection
 {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width,traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350: 800);
-
+    CGFloat width = [UIScreen mainScreen].bounds.size.width;
+    CGFloat height = [UIScreen mainScreen].bounds.size.height;
+    
+    CGFloat mWidth = fmin(width, height);
+    CGFloat mHeight = fmax(width, height);
+    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width,traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? mWidth*0.9 : mHeight*0.9);
 }
 
 

+ 1 - 1
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.h

@@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)updateUndoRedoState;
 
-- (void)buttonItemClicked_open:(UIButton *)button;
+- (void)buttonItemClicked_openAnnotation:(id)button;
 
 - (void)openSignatureAnnotation:(CPDFSignatureWidgetAnnotation *)signatureAnnotation;
 

+ 23 - 8
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m

@@ -272,7 +272,7 @@
     
     _propertiesBtn = [[UIButton alloc] initWithFrame:CGRectMake(offset, topOffset, buttonSize, buttonSize)];
     [_propertiesBtn setImage:[UIImage imageNamed:@"CPDFAnnotationBarImageProperties" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
-    [_propertiesBtn addTarget:self action:@selector(buttonItemClicked_open:) forControlEvents:UIControlEventTouchUpInside];
+    [_propertiesBtn addTarget:self action:@selector(buttonItemClicked_openModel:) forControlEvents:UIControlEventTouchUpInside];
     [self.propertiesBar addSubview:self.propertiesBtn];
     offset += self.propertiesBtn.frame.size.width;
 
@@ -329,7 +329,8 @@
         
         self.pdfListView.annotationMode = self.selectedIndex;
 
-        [self.annotManage setAnnotStyleFromMode:self.selectedIndex];
+//        [self.annotManage setAnnotStyleFromMode:self.selectedIndex];
+//        self.isModelProperties = YES;
         isSelect = YES;
 
     } else {
@@ -352,6 +353,16 @@
     }
 }
 
+- (void)buttonItemClicked_openModel:(id)button {
+    [self.annotManage setAnnotStyleFromMode:self.pdfListView.annotationMode];
+    [self buttonItemClicked_open:button];
+}
+
+- (void)buttonItemClicked_openAnnotation:(id)button {
+    [self.annotManage setAnnotStyleFromAnnotations:self.pdfListView.activeAnnotations];
+    [self buttonItemClicked_open:button];
+}
+
 - (void)buttonItemClicked_open:(id)button {
     CAnnotStyle *annotStytle = self.annotManage.annotStyle;
     AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
@@ -906,12 +917,16 @@
 }
 
 - (void)annotationChangedNotification:(NSNotification *)notification {
-    if (self.pdfListView.annotationMode == CPDFViewAnnotationModeNone) {
-        [self.annotManage setAnnotStyleFromAnnotations:self.pdfListView.activeAnnotations];
-    } else {
-        [self.annotManage setAnnotStyleFromMode:self.pdfListView.annotationMode];
-
-    }
+//    if (self.pdfListView.annotationMode == CPDFViewAnnotationModeNone) {
+//        [self.annotManage setAnnotStyleFromAnnotations:self.pdfListView.activeAnnotations];
+//    } else {
+//        [self.annotManage setAnnotStyleFromMode:self.pdfListView.annotationMode];
+//
+//    }
+//    if (self.pdfListView.annotationMode == CPDFViewAnnotationModeNone) {
+//        [self.annotManage setAnnotStyleFromMode:self.pdfListView.annotationMode];
+//    }
+//    self.isModelProperties = YES;
     [self updatePropertiesButtonState];
 }
 

+ 1 - 0
compdfkit-tools/compdfkit-tools/PageEdit/Control/CPDFPageInsertViewController.m

@@ -128,6 +128,7 @@
         self.saveButton.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, 40);
         self.cancelBtn.frame = CGRectMake(20, 5, 50, 40);
     }
+    
 }
 
 #pragma mark - Action

+ 5 - 3
compdfkit-tools/compdfkit-tools/PageEdit/Views/CInsertBlankPageCell.m

@@ -208,16 +208,18 @@
 }
 
 - (UIView *)directSelectViewCreate {
-    UIView *tSelectView = [[UIView alloc] initWithFrame:CGRectMake(0, 5, 100, 50)];
+    UIView *tSelectView = [[UIView alloc] initWithFrame:CGRectMake(0, 8, 88, 44)];
+    tSelectView.layer.cornerRadius = 5;
+    tSelectView.layer.masksToBounds = YES;
     
-    self.verticalPageBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
+    self.verticalPageBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 44, 44)];
     self.verticalPageBtn.tag = 0;
     self.verticalPageBtn.selected = NO;
     self.verticalPageBtn.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
     [self.verticalPageBtn setImage:[UIImage imageNamed:@"CInsertBlankPageCellVertical" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.verticalPageBtn addTarget:self action:@selector(buttonItemClicked_direction:) forControlEvents:UIControlEventTouchUpInside];
     
-    self.horizontalPageBtn = [[UIButton alloc]initWithFrame:CGRectMake(50, 0, 50, 50)];
+    self.horizontalPageBtn = [[UIButton alloc]initWithFrame:CGRectMake(44, 0, 44, 44)];
     self.horizontalPageBtn.selected = NO;
     self.horizontalPageBtn.tag = 1;
     self.horizontalPageBtn.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];