ソースを参照

Merge branch 'compdfkit_demo_ios' of git.kdan.cc:others/kmpdfkit_demo into compdfkit_demo_ios

chenyu 1 年間 前
コミット
1086ff678f
18 ファイル変更151 行追加43 行削除
  1. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkTopToolBar.m
  2. 2 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.m
  3. 3 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewCell.m
  4. 1 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.m
  5. 3 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CCustomizeStampTableViewCell.m
  6. 14 5
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CPDFStampViewController.m
  7. 19 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampColorSelectView.m
  8. 12 4
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampShapView.m
  9. 1 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampTextViewController.m
  10. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageCenter.imageset/Contents.json
  11. 8 8
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageCenter.imageset/With Label.pdf
  12. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageNone.imageset/Contents.json
  13. 13 13
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageNone.imageset/With Label (3).pdf
  14. 11 0
      compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m
  15. 2 2
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleCell.m
  16. 2 0
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleView.h
  17. 6 2
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleView.m
  18. 51 6
      compdfkit-tools/compdfkit-tools/PageEdit/Control/CPDFPageInsertViewController.m

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkTopToolBar.m

@@ -69,7 +69,7 @@
         clearButton.tag = CPDFInkTopToolBarClear;
         clearButton.frame = CGRectMake(4*width, 0, width, height);
         [clearButton setTitle:NSLocalizedString(@"Clear", nil) forState:UIControlStateNormal];
-        [clearButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+        [clearButton setTitleColor:[CPDFColorUtils CPageEditToolbarFontColor] forState:UIControlStateNormal];
         clearButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
         [clearButton addTarget:self action:@selector(buttonItemClicked_Switch:) forControlEvents:UIControlEventTouchUpInside];
         [self addSubview:clearButton];

+ 2 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.m

@@ -186,6 +186,7 @@
     self.startArrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:NSLocalizedString(@"Arrow Style",nil)];
     self.startArrowStyleView.frame = self.view.frame;
     self.startArrowStyleView.delegate = self;
+    self.startArrowStyleView.selectIndex = self.startDrawView.selectIndex;
     self.startArrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self.view addSubview:self.startArrowStyleView];
     [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
@@ -195,6 +196,7 @@
     self.endArrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:NSLocalizedString(@"Arrowtail style",nil)];
     self.endArrowStyleView.frame = self.view.frame;
     self.endArrowStyleView.delegate = self;
+    self.endArrowStyleView.selectIndex = self.endDrawView.selectIndex;
     self.endArrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self.view addSubview:self.endArrowStyleView];
     [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];

+ 3 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewCell.m

@@ -12,6 +12,8 @@
 
 #import "CPDFSignatureViewCell.h"
 
+#import <compdfkit_tools/CPDFColorUtils.h>
+
 @interface CPDFSignatureViewCell ()
 
 @property (nonatomic, strong) UIButton *deleteButton;
@@ -29,6 +31,7 @@
         [self.deleteButton setImage:[UIImage imageNamed:@"CPDFSignatureImageDelete" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [self.deleteButton addTarget:self action:@selector(buttonItemClicked_delete:) forControlEvents:UIControlEventTouchUpInside];
         [self.contentView addSubview:self.deleteButton];
+        self.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
     }
     return self;
 }

+ 1 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.m

@@ -72,6 +72,7 @@
     [self.headerView addSubview:self.backBtn];
     
     self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height - 120) style:UITableViewStylePlain];
+    self.tableView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
     self.tableView.delegate = self;
     self.tableView.dataSource = self;
     self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

+ 3 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CCustomizeStampTableViewCell.m

@@ -12,6 +12,8 @@
 
 #import "CCustomizeStampTableViewCell.h"
 
+#import <compdfkit_tools/CPDFColorUtils.h>
+
 @interface CCustomizeStampTableViewCell ()
 
 @property (nonatomic, strong) UIButton *deleteButton;
@@ -29,6 +31,7 @@
         [self.deleteButton setImage:[UIImage imageNamed:@"CPDFSignatureImageDelete" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [self.deleteButton addTarget:self action:@selector(buttonItemClicked_delete:) forControlEvents:UIControlEventTouchUpInside];
         [self.contentView addSubview:self.deleteButton];
+        self.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
     }
     return self;
 }

+ 14 - 5
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CPDFStampViewController.m

@@ -210,21 +210,24 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
     [self.view addSubview:self.customizeView];
     self.customizeView.hidden = YES;
     
-    self.emptyLabel = [[UILabel alloc] init];
-    self.emptyLabel.text = NSLocalizedString(@"NO Custom", nil);
-    self.emptyLabel.textAlignment = NSTextAlignmentCenter;
-    [self.customizeView addSubview:self.emptyLabel];
-    
     self.tableView = [[UITableView alloc] initWithFrame:self.customizeView.bounds style:UITableViewStyleGrouped];
     self.tableView.delegate = self;
     self.tableView.dataSource = self;
     self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    self.tableView.backgroundColor = [UIColor clearColor];
     self.tableView.rowHeight = 60;
     [self.customizeView addSubview:self.tableView];
     
+    self.emptyLabel = [[UILabel alloc] init];
+    self.emptyLabel.text = NSLocalizedString(@"NO Custom", nil);
+    self.emptyLabel.textAlignment = NSTextAlignmentCenter;
+    [self.customizeView addSubview:self.emptyLabel];
+    
     if ((self.customImageArray.count < 1) && (self.customTextArray.count < 1)) {
         self.tableView.hidden = YES;
+        self.emptyLabel.hidden = NO;
     } else {
+        self.emptyLabel.hidden = YES;
         self.tableView.hidden = NO;
     }
     
@@ -373,8 +376,10 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
         [self.stampFileManager insertStampItem:tStampItem type:PDFStampCustomType_Image];
         [self.tableView reloadData];
         if ((self.customImageArray.count < 1) && (self.customTextArray.count < 1)) {
+            self.emptyLabel.hidden = NO;
             self.tableView.hidden = YES;
         } else {
+            self.emptyLabel.hidden = YES;
             self.tableView.hidden = NO;
         }
     }
@@ -716,8 +721,10 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
         
         [self.tableView reloadData];
         if ((self.customImageArray.count < 1) && (self.customTextArray.count < 1)) {
+            self.emptyLabel.hidden = NO;
             self.tableView.hidden = YES;
         } else {
+            self.emptyLabel.hidden = YES;
             self.tableView.hidden = NO;
         }
     }];
@@ -736,8 +743,10 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
     [self.tableView reloadData];
     
     if ((self.customImageArray.count < 1) && (self.customTextArray.count < 1)) {
+        self.emptyLabel.hidden = NO;
         self.tableView.hidden = YES;
     } else {
+        self.emptyLabel.hidden = YES;
         self.tableView.hidden = NO;
     }
 }

+ 19 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampColorSelectView.m

@@ -60,6 +60,25 @@
         view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
         view.layer.borderColor = [UIColor whiteColor].CGColor;
         view.layer.borderWidth = 1.0;
+        
+        if(self.selectedColor) {
+            CGFloat red1, green1, blue1, alpha1;
+            [self.selectedColor getRed:&red1 green:&green1 blue:&blue1 alpha:&alpha1];
+
+            CGFloat red2, green2, blue2, alpha2;
+            [colors[i] getRed:&red2 green:&green2 blue:&blue2 alpha:&alpha2];
+            
+            if (fabs(red1 - red2) < FLT_EPSILON &&
+                fabs(green1 - green2) < FLT_EPSILON &&
+                fabs(blue1 - blue2) < FLT_EPSILON) {
+                view.layer.borderColor = [UIColor colorWithRed:20.0/255.0 green:96.0/255.0 blue:243.0/255.0 alpha:1.0].CGColor;
+            } else {
+                view.layer.borderColor = [UIColor whiteColor].CGColor;
+            }
+        } else {
+            view.layer.borderColor = [UIColor whiteColor].CGColor;
+        }
+        
         view.backgroundColor = [CPDFColorUtils CPDFViewControllerBackgroundColor];
         [array addObject:view];
         [self.colorPickerView addSubview:view];

+ 12 - 4
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampShapView.m

@@ -54,6 +54,8 @@
         [self.centerButton setImage:[UIImage imageNamed:@"CPDFStampTextImageCenter" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [self.centerButton addTarget:self action:@selector(buttonItemClicked_select:) forControlEvents:UIControlEventTouchUpInside];
         self.centerButton.tag = 0;
+        self.centerButton.layer.cornerRadius = 5.0;
+        self.centerButton.layer.masksToBounds = YES;
         [self.shapeView addSubview:self.centerButton];
         [self.buttonArray addObject:self.centerButton];
         
@@ -63,6 +65,8 @@
         [self.leftButton setImage:[UIImage imageNamed:@"CPDFStampTextImageLeft" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [self.leftButton addTarget:self action:@selector(buttonItemClicked_select:) forControlEvents:UIControlEventTouchUpInside];
         self.leftButton.tag = 1;
+        self.leftButton.layer.cornerRadius = 5.0;
+        self.leftButton.layer.masksToBounds = YES;
         [self.shapeView addSubview:self.leftButton];
         [self.buttonArray addObject:self.leftButton];
         
@@ -70,6 +74,8 @@
         [self.rightButton setImage:[UIImage imageNamed:@"CPDFStampTextImageRight" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [self.rightButton addTarget:self action:@selector(buttonItemClicked_select:) forControlEvents:UIControlEventTouchUpInside];
         self.rightButton.tag = 2;
+        self.rightButton.layer.cornerRadius = 5.0;
+        self.rightButton.layer.masksToBounds = YES;
         [self.shapeView addSubview:self.rightButton];
         [self.buttonArray addObject:self.rightButton];
         
@@ -77,6 +83,8 @@
         [self.noneButton setImage:[UIImage imageNamed:@"CPDFStampTextImageNone" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [self.noneButton addTarget:self action:@selector(buttonItemClicked_select:) forControlEvents:UIControlEventTouchUpInside];
         self.noneButton.tag = 3;
+        self.noneButton.layer.cornerRadius = 5.0;
+        self.noneButton.layer.masksToBounds = YES;
         [self.shapeView addSubview:self.noneButton];
         [self.buttonArray addObject:self.noneButton];
     }
@@ -87,10 +95,10 @@
     [super layoutSubviews];
     self.titleLabel.frame = CGRectMake(20, 0, 50, self.bounds.size.height/3);
     self.shapeView.frame = CGRectMake(0, self.bounds.size.height/3, self.bounds.size.width, (self.bounds.size.height/3)*2);
-    self.centerButton.frame = CGRectMake((self.shapeView.bounds.size.width - (self.shapeView.bounds.size.height*4))/5, 0, self.shapeView.bounds.size.height, self.shapeView.bounds.size.height-10);
-    self.leftButton.frame = CGRectMake(((self.shapeView.bounds.size.width - (self.shapeView.bounds.size.height*4))/5)*2 + self.shapeView.bounds.size.height, 0, self.shapeView.bounds.size.height, self.shapeView.bounds.size.height);
-    self.rightButton.frame = CGRectMake(((self.shapeView.bounds.size.width - (self.shapeView.bounds.size.height*4))/5)*3 + self.shapeView.bounds.size.height*2, 0, self.shapeView.bounds.size.height, self.shapeView.bounds.size.height);
-    self.noneButton.frame = CGRectMake(((self.shapeView.bounds.size.width - (self.shapeView.bounds.size.height*4))/5)*4 + self.shapeView.bounds.size.height*3, 0, self.shapeView.bounds.size.height, self.shapeView.bounds.size.height);
+    self.centerButton.frame = CGRectMake((self.shapeView.bounds.size.width - (44*4))/5, (self.shapeView.bounds.size.height-44)/2, 44, 44);
+    self.leftButton.frame = CGRectMake(((self.shapeView.bounds.size.width - (44*4))/5)*2 + 44, (self.shapeView.bounds.size.height-44)/2, 44, 44);
+    self.rightButton.frame = CGRectMake(((self.shapeView.bounds.size.width - (44*4))/5)*3 + 44*2, (self.shapeView.bounds.size.height-44)/2, 44, 44);
+    self.noneButton.frame = CGRectMake(((self.shapeView.bounds.size.width - (44*4))/5)*4 + 44*3, (self.shapeView.bounds.size.height-44)/2, 44, 44);
 }
 
 #pragma mark - Action

+ 1 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampTextViewController.m

@@ -111,6 +111,7 @@
     self.colorView = [[CStampColorSelectView alloc] init];
     self.colorView.delegate = self;
     self.colorView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+    self.colorView.selectedColor = [UIColor blackColor];
     [self.scrcollView addSubview:self.colorView];
     
     self.stampShapeViw = [[CStampShapView alloc] init];

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageCenter.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "With Label.pdf",
+      "filename" : "rec.pdf",
       "idiom" : "universal"
     },
     {

+ 8 - 8
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageCenter.imageset/With Label.pdf

@@ -10,7 +10,7 @@ stream
 /DeviceRGB CS
 /DeviceRGB cs
 q
-1.000000 0.000000 -0.000000 1.000000 11.250000 13.250000 cm
+1.000000 0.000000 -0.000000 1.000000 1.250000 3.250000 cm
 0.262745 0.278431 0.301961 scn
 17.500000 13.500000 m
 0.000000 13.500000 l
@@ -32,13 +32,13 @@ endstream
 endobj
 
 3 0 obj
-  344
+  342
 endobj
 
 4 0 obj
   << /Annots []
      /Type /Page
-     /MediaBox [ 0.000000 0.000000 40.000000 40.000000 ]
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000000 ]
      /Resources 1 0 R
      /Contents 2 0 R
      /Parent 5 0 R
@@ -63,15 +63,15 @@ xref
 0000000000 65535 f
 0000000010 00000 n
 0000000034 00000 n
-0000000434 00000 n
-0000000456 00000 n
-0000000629 00000 n
-0000000703 00000 n
+0000000432 00000 n
+0000000454 00000 n
+0000000627 00000 n
+0000000701 00000 n
 trailer
 << /ID [ (some) (id) ]
    /Root 6 0 R
    /Size 7
 >>
 startxref
-762
+760
 %%EOF

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageNone.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "With Label (3).pdf",
+      "filename" : "line.pdf",
       "idiom" : "universal"
     },
     {

+ 13 - 13
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/Image.xcassets/CPDFStampTextImageNone.imageset/With Label (3).pdf

@@ -10,13 +10,13 @@ stream
 /DeviceRGB CS
 /DeviceRGB cs
 q
-1.000000 0.000000 -0.000000 1.000000 12.469727 11.469727 cm
+1.000000 0.000000 -0.000000 1.000000 2.469727 1.469669 cm
 0.262745 0.278431 0.301961 scn
-14.000000 15.060547 m
-15.060660 13.999887 l
-1.060660 -0.000113 l
-0.000000 1.060547 l
-14.000000 15.060547 l
+14.000000 15.060661 m
+15.060660 14.000001 l
+1.060660 0.000001 l
+0.000000 1.060661 l
+14.000000 15.060661 l
 h
 f*
 n
@@ -26,13 +26,13 @@ endstream
 endobj
 
 3 0 obj
-  237
+  234
 endobj
 
 4 0 obj
   << /Annots []
      /Type /Page
-     /MediaBox [ 0.000000 0.000000 40.000000 40.000000 ]
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000000 ]
      /Resources 1 0 R
      /Contents 2 0 R
      /Parent 5 0 R
@@ -57,15 +57,15 @@ xref
 0000000000 65535 f
 0000000010 00000 n
 0000000034 00000 n
-0000000327 00000 n
-0000000349 00000 n
-0000000522 00000 n
-0000000596 00000 n
+0000000324 00000 n
+0000000346 00000 n
+0000000519 00000 n
+0000000593 00000 n
 trailer
 << /ID [ (some) (id) ]
    /Root 6 0 R
    /Size 7
 >>
 startxref
-655
+652
 %%EOF

+ 11 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m

@@ -502,6 +502,7 @@
 
 - (void)createPropertyViewController {
     if (CPDFViewAnnotationModeInk == self.selectedIndex) {
+        [self.annotManage setAnnotStyleFromMode:self.pdfListView.annotationMode];
 
         self.propertiesBtn.enabled = NO;
         if (@available(iOS 11.0, *)) {
@@ -783,10 +784,16 @@
             break;
         case CPDFInkTopToolBarUndo: {
             [self.annotManage.pdfListView drawUndo];
+            if (((UIButton *)self.topToolBar.buttonArray[1]).selected) {
+                ((UIButton *)self.topToolBar.buttonArray[1]).backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+            }
         }
             break;
         case CPDFInkTopToolBarRedo: {
             [self.annotManage.pdfListView drawRedo];
+            if (((UIButton *)self.topToolBar.buttonArray[1]).selected) {
+                ((UIButton *)self.topToolBar.buttonArray[1]).backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+            }
         }
             break;
         case CPDFInkTopToolBarClear: {
@@ -817,6 +824,7 @@
     if (annotStyle.isSelectAnnot) {
         [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     } else {
+       
         for (CPDFAnnotationBarButton *button in self.annotationBtns) {
              if (CPDFViewAnnotationModeInk == button.tag) {
                 button.lineColor = CAnnotationManage.freehandAnnotationColor;
@@ -830,6 +838,9 @@
 - (void)inkViewControllerDimiss:(CPDFInkViewController *)inkViewController {
     if ([self.topToolBar isDescendantOfView:self.pdfListView]) {
         ((UIButton *)self.topToolBar.buttonArray[0]).backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
+        if (((UIButton *)self.topToolBar.buttonArray[1]).selected) {
+            ((UIButton *)self.topToolBar.buttonArray[1]).backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+        }
     }
 }
 

+ 2 - 2
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleCell.m

@@ -21,8 +21,8 @@
 - (instancetype)initWithFrame:(CGRect)frame {
     if (self = [super initWithFrame:frame]) {
         self.contextView = [[CPDFDrawArrowView alloc] initWithFrame:CGRectMake(1, 1, self.bounds.size.width - 2, self.bounds.size.height - 2)];
-        self.contextView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
-        self.contentView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
+        self.contextView.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
+        self.contentView.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
         [self addSubview:self.contextView];
     }
     return self;

+ 2 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleView.h

@@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, weak) id<CPDFArrowStyleViewDelegate> delegate;
 
+@property (nonatomic, assign) NSInteger selectIndex;
+
 - (instancetype)initWirhTitle:(NSString *)title;
 
 @end

+ 6 - 2
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFArrowStyleView.m

@@ -47,6 +47,7 @@
         
         self.titleLabel = [[UILabel alloc] init];
         self.titleLabel.text = title;
+        self.titleLabel.textAlignment = NSTextAlignmentCenter;
         [self.headerView addSubview:self.titleLabel];
         
         UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
@@ -70,7 +71,7 @@
 - (void)layoutSubviews {
     [super layoutSubviews];
     self.backBtn.frame = CGRectMake(15, 5, 60, 50);
-    self.titleLabel.frame = CGRectMake((self.frame.size.width - 100)/2, 5, 100, 50);
+    self.titleLabel.frame = CGRectMake((self.frame.size.width - 150)/2, 5, 150, 50);
     self.headerView.frame = CGRectMake(0, 0, self.bounds.size.width, 50);
 }
 
@@ -95,6 +96,9 @@
 
 - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
     CPDFArrowStyleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
+    if (self.selectIndex == indexPath.item) {
+        cell.contextView.backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];
+    }
     cell.contextView.selectIndex = indexPath.item;
     [cell.contentView setNeedsDisplay];
     cell.backgroundColor = [UIColor clearColor];
@@ -106,7 +110,7 @@
 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
     NSArray<UICollectionViewCell *> *cells = [collectionView visibleCells];
     for (UICollectionViewCell *cell in cells) {
-        ((CPDFArrowStyleCell *)cell).contextView.backgroundColor = [UIColor whiteColor];
+        ((CPDFArrowStyleCell *)cell).contextView.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
     }
     CPDFArrowStyleCell *cell = (CPDFArrowStyleCell *)[collectionView cellForItemAtIndexPath:indexPath];
     cell.contextView.backgroundColor = [CPDFColorUtils CAnnotationBarSelectBackgroundColor];

+ 51 - 6
compdfkit-tools/compdfkit-tools/PageEdit/Control/CPDFPageInsertViewController.m

@@ -39,6 +39,8 @@
 
 @property (nonatomic, assign) CPDFPageInsertType pageInsertType;
 
+@property (nonatomic, strong) NSString *pageType;
+
 @end
 
 @implementation CPDFPageInsertViewController
@@ -114,6 +116,8 @@
                                              selector:@selector(keyboardWillHide:)
                                                  name:UIKeyboardWillHideNotification
                                                object:nil];
+    
+    self.pageType = @"A4 (210 X 297mm)";
 }
 
 - (void)viewWillLayoutSubviews {
@@ -135,6 +139,39 @@
 - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
     [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
     [self.tableView reloadData];
+    [self setPageSizeRefresh];
+}
+
+#pragma mark - Private Methods
+
+- (void)setPageSizeRefresh {
+    NSArray *szieArray = @[@"A3 (297 X 420mm)", @"A4 (210 X 297mm)", @"A5 (148 X 210mm)"];
+    if (self.isSelect) {
+        NSIndexPath* path = [NSIndexPath indexPathForRow:0 inSection:0];
+        CInsertBlankPageCell *cell = [self.tableView cellForRowAtIndexPath:path];
+        NSInteger index = [szieArray indexOfObject:self.pageType];
+        
+        switch (index) {
+            case 0:
+            {
+                NSIndexPath* path = [NSIndexPath indexPathForRow:1 inSection:0];
+                [self.tableView selectRowAtIndexPath:path animated:NO scrollPosition:UITableViewScrollPositionMiddle];
+            }
+                break;
+            case 1:
+            {
+                NSIndexPath* path = [NSIndexPath indexPathForRow:2 inSection:0];
+                [self.tableView selectRowAtIndexPath:path animated:NO scrollPosition:UITableViewScrollPositionMiddle];
+            }
+                break;
+            case 2:
+            {
+                NSIndexPath* path = [NSIndexPath indexPathForRow:3 inSection:0];
+                [self.tableView selectRowAtIndexPath:path animated:NO scrollPosition:UITableViewScrollPositionMiddle];
+            }
+                break;
+        }
+    }
 }
 
 #pragma mark - Action
@@ -168,6 +205,10 @@
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     CInsertBlankPageCell *cell = [[CInsertBlankPageCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"pageCell"];
     cell.delegate = self;
+    
+    if (self.pageLoactionBtns.count > 3) {
+        [self.pageLoactionBtns removeAllObjects];
+    }
 
     switch (indexPath.row) {
         case 0:
@@ -341,6 +382,7 @@
             if (self.isSelect) {
                 self.pageModel.size = CGSizeMake(297, 420);
                 cell.sizeLabel.text = @"A3 (297 X 420mm)";
+                self.pageType = @"A3 (297 X 420mm)";
             }
         }
             break;
@@ -349,6 +391,7 @@
             if (self.isSelect) {
                 self.pageModel.size = CGSizeMake(210, 297);
                 cell.sizeLabel.text = @"A4 (210 X 297mm)";
+                self.pageType = @"A4 (210 X 297mm)";
             }
         }
             break;
@@ -357,6 +400,7 @@
             if (self.isSelect) {
                 self.pageModel.size = CGSizeMake(148, 210);
                 cell.sizeLabel.text = @"A5 (148 X 210mm)";
+                self.pageType = @"A5 (148 X 210mm)";
             }
         }
             break;
@@ -375,8 +419,6 @@
     
     if (isSelect) {
         NSInteger t = indexPath.row;
-        NSLog(@"t is %zd",t);
-        NSMutableArray *array = [NSMutableArray array];
         NSMutableArray *data = [NSMutableArray arrayWithArray:self.dataArray];
         for (NSString *str in szieArray) {
             t++;
@@ -389,9 +431,10 @@
         }
         self.dataArray = (NSArray *)data;
         
+        [self.tableView reloadData];
+        [self setPageSizeRefresh];
     } else {
         NSInteger t = indexPath.row;
-        NSMutableArray *array = [NSMutableArray array];
         NSMutableArray *data = [NSMutableArray arrayWithArray:self.dataArray];
         for (int i = 0; i < szieArray.count; i++) {
             t++;
@@ -401,11 +444,13 @@
             }
         }
         self.dataArray = (NSArray *)data;
+        
+        [self.tableView reloadData];
     }
     
-    NSLog(@"dataArray %@",self.dataArray);
-    
-    [self.tableView reloadData];
+    NSIndexPath* path = [NSIndexPath indexPathForRow:0 inSection:0];
+    CInsertBlankPageCell *cell = [self.tableView cellForRowAtIndexPath:path];
+    cell.sizeLabel.text = self.pageType;
 }
 
 - (void)insertBlankPageCellLocation:(CInsertBlankPageCell *)insertBlankPageCell button:(nonnull UIButton *)buttom {