Ver código fonte

PDFTools(iOS)-stamp text 页面的修改

yangliuhua 1 ano atrás
pai
commit
1b20cf7139

+ 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