Browse Source

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

chenyu 1 năm trước cách đây
mục cha
commit
ec6e406178
14 tập tin đã thay đổi với 88 bổ sung32 xóa
  1. 21 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureEditViewController.m
  2. 5 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CPDFStampViewController.m
  3. 13 0
      compdfkit-tools/compdfkit-tools/Common/Utils/AAPLCustomPresentationController.h
  4. 3 0
      compdfkit-tools/compdfkit-tools/Common/Utils/AAPLCustomPresentationController.m
  5. 4 4
      compdfkit-tools/compdfkit-tools/Common/Utils/UtilsColor.xcassets/CAnnotationBarNoSelectBackgroundColor.colorset/Contents.json
  6. 18 0
      compdfkit-tools/compdfkit-tools/Common/Utils/UtilsColor.xcassets/CAnnotationBarSelectBackgroundColor.colorset/Contents.json
  7. 17 18
      compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m
  8. 1 1
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Annotation.m
  9. 1 0
      compdfkit-tools/compdfkit-tools/PageEdit/Views/CInsertBlankPageCell.m
  10. 1 1
      compdfkit-tools/compdfkit-tools/PageEdit/Views/CPageEditToolBar.m
  11. 1 1
      compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellHorizontal.imageset/Contents.json
  12. 1 1
      compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellHorizontal.imageset/Status=sel 1.pdf
  13. 1 1
      compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellVertical.imageset/Contents.json
  14. 1 1
      compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellVertical.imageset/Status=sel 1.pdf

+ 21 - 2
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureEditViewController.m

@@ -236,10 +236,25 @@
     [self updatePreferredContentSizeWithTraitCollection:newCollection];
 }
 
+
+
 #pragma mark - Private Methods
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 750);
+    CGFloat width = [UIScreen mainScreen].bounds.size.width;
+    CGFloat height = [UIScreen mainScreen].bounds.size.height;
+    
+    CGFloat mWidth = fmin(width, height);
+    CGFloat mHeight = fmax(width, height);
+    
+    UIDevice *currentDevice = [UIDevice currentDevice];
+    if (currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
+        // This is an iPad
+        self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? mWidth*0.5 : mHeight*0.6);
+    } else {
+        // This is an iPhone or iPod touch
+        self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? mWidth*0.9 : mHeight*0.9);
+    }
 }
 
 - (void)createGestureRecognizer {
@@ -410,6 +425,10 @@
         imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
         imagePickerController.allowsEditing = YES;
         imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
+        if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) {
+            imagePickerController.popoverPresentationController.sourceView = self.segmentedControl;;
+            imagePickerController.popoverPresentationController.sourceRect = CGRectMake(CGRectGetMaxX(self.segmentedControl.bounds), CGRectGetMaxY(self.segmentedControl.bounds), 1, 1);
+        }
         [self presentViewController:imagePickerController animated:YES completion:nil];
     }];
     
@@ -437,7 +456,7 @@
 
 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
     [picker dismissViewControllerAnimated:YES completion:nil];
-    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
+    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
     
     UIImageOrientation imageOrientation = image.imageOrientation;
     if (imageOrientation!=UIImageOrientationUp) {

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

@@ -297,6 +297,10 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
         imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
         imagePickerController.allowsEditing = YES;
         imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
+        if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) {
+            imagePickerController.popoverPresentationController.sourceView = self.imageButton;
+            imagePickerController.popoverPresentationController.sourceRect = self.imageButton.bounds;
+        }
         [self presentViewController:imagePickerController animated:YES completion:nil];
     }];
     
@@ -339,7 +343,7 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
 
 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
     [picker dismissViewControllerAnimated:YES completion:nil];
-    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
+    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
     
     UIImageOrientation imageOrientation = image.imageOrientation;
     if (imageOrientation!=UIImageOrientationUp) {
@@ -397,7 +401,6 @@ PDFAnnotationStampKey const PDFAnnotationStampKeyShape = @"PDFAnnotationStampKey
         // This is an iPhone or iPod touch
         self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? mWidth*0.9 : mHeight*0.9);
     }
-   
 }
 
 #pragma mark - Action

+ 13 - 0
compdfkit-tools/compdfkit-tools/Common/Utils/AAPLCustomPresentationController.h

@@ -12,5 +12,18 @@
 
 @import UIKit;
 
+@class AAPLCustomPresentationController;
+
+@protocol AAPLCustomPresentationControllerDelegate <NSObject>
+
+@optional
+
+- (void)AAPLCustomPresentationControllerTap:(AAPLCustomPresentationController *)AAPLCustomPresentationController;
+
+@end
+
 @interface AAPLCustomPresentationController : UIPresentationController <UIViewControllerTransitioningDelegate>
+
+@property (nonatomic, weak) id<AAPLCustomPresentationControllerDelegate> tapDelegate;
+
 @end

+ 3 - 0
compdfkit-tools/compdfkit-tools/Common/Utils/AAPLCustomPresentationController.m

@@ -231,6 +231,9 @@
 - (IBAction)dimmingViewTapped:(UITapGestureRecognizer*)sender
 {
     [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
+    if (self.tapDelegate && [self.tapDelegate respondsToSelector:@selector(AAPLCustomPresentationControllerTap:)]) {
+        [self.tapDelegate AAPLCustomPresentationControllerTap:self];
+    }
 }
 
 #pragma mark -

+ 4 - 4
compdfkit-tools/compdfkit-tools/Common/Utils/UtilsColor.xcassets/CAnnotationBarNoSelectBackgroundColor.colorset/Contents.json

@@ -22,10 +22,10 @@
       "color" : {
         "color-space" : "srgb",
         "components" : {
-          "alpha" : "0.500",
-          "blue" : "255",
-          "green" : "153",
-          "red" : "100"
+          "alpha" : "1.000",
+          "blue" : "115",
+          "green" : "103",
+          "red" : "96"
         }
       },
       "idiom" : "universal"

+ 18 - 0
compdfkit-tools/compdfkit-tools/Common/Utils/UtilsColor.xcassets/CAnnotationBarSelectBackgroundColor.colorset/Contents.json

@@ -11,6 +11,24 @@
         }
       },
       "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "255",
+          "green" : "153",
+          "red" : "100"
+        }
+      },
+      "idiom" : "universal"
     }
   ],
   "info" : {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 17 - 18
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m


+ 1 - 1
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Annotation.m

@@ -195,8 +195,8 @@
     if ([self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
         [(CPDFSignatureAnnotation *)self.activeAnnotation signature];
         
-        [self updateActiveAnnotations:@[]];
         [self setNeedsDisplayForPage:self.activeAnnotation.page];
+        [self updateActiveAnnotations:@[]];
         [self updateScrollEnabled];
     }
 }

+ 1 - 0
compdfkit-tools/compdfkit-tools/PageEdit/Views/CInsertBlankPageCell.m

@@ -236,6 +236,7 @@
     UITextField *tTextField = [[UITextField alloc] initWithFrame:rect];
     
     tTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
+    tTextField.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
     tTextField.returnKeyType = UIReturnKeyDone;
     tTextField.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 8, 0)];
     tTextField.leftViewMode = UITextFieldViewModeAlways;

+ 1 - 1
compdfkit-tools/compdfkit-tools/PageEdit/Views/CPageEditToolBar.m

@@ -40,7 +40,7 @@
 
 - (instancetype)initWithFrame:(CGRect)frame {
     if (self = [super initWithFrame:frame]) {
-        self.backgroundColor = [CPDFColorUtils CPDFViewControllerBackgroundColor];
+        self.backgroundColor = [CPDFColorUtils CAnnotationBarNoSelectBackgroundColor];
         
         UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 1)];
         line.backgroundColor = [UIColor colorWithRed:210.0/255.0 green:210.0/255.0 blue:210.0/255.0 alpha:1.0];

+ 1 - 1
compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellHorizontal.imageset/Contents.json

@@ -11,7 +11,7 @@
           "value" : "dark"
         }
       ],
-      "filename" : "Status=sel 1.pdf",
+      "filename" : "Status=nor.pdf",
       "idiom" : "universal"
     }
   ],

+ 1 - 1
compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellHorizontal.imageset/Status=sel 1.pdf

@@ -11,7 +11,7 @@ stream
 /DeviceRGB cs
 q
 0.000000 1.000000 1.000000 -0.000000 4.250000 2.750000 cm
-0.391667 0.598991 1.000000 scn
+1.000000 1.000000 1.000000 scn
 0.750000 14.500000 m
 0.000000 14.500000 l
 0.000000 13.750000 l

+ 1 - 1
compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellVertical.imageset/Contents.json

@@ -11,7 +11,7 @@
           "value" : "dark"
         }
       ],
-      "filename" : "Status=sel 1.pdf",
+      "filename" : "Status=nor.pdf",
       "idiom" : "universal"
     }
   ],

+ 1 - 1
compdfkit-tools/compdfkit-tools/PageEdit/Views/Image.xcassets/CInsertBlankPageCellVertical.imageset/Status=sel 1.pdf

@@ -11,7 +11,7 @@ stream
 /DeviceRGB cs
 q
 1.000000 0.000000 -0.000000 1.000000 2.750000 1.250000 cm
-0.391667 0.598991 1.000000 scn
+1.000000 1.000000 1.000000 scn
 0.750000 17.500000 m
 0.000000 17.500000 l
 0.000000 16.750000 l