Переглянути джерело

PDFTools(iOS)-周末bug修改

yangliuhua 1 рік тому
батько
коміт
cf0d408595

+ 8 - 0
compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj

@@ -44,6 +44,8 @@
 		4FECFF6A2A15FBC7008DE530 /* CPDFEditTextSampleView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FECFF682A15FBC7008DE530 /* CPDFEditTextSampleView.h */; };
 		4FECFF6B2A15FBC7008DE530 /* CPDFEditTextSampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FECFF692A15FBC7008DE530 /* CPDFEditTextSampleView.m */; };
 		4FF3E1D12A064A8200C14F91 /* CPDFListView+Edit.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FF3E1CF2A064A8100C14F91 /* CPDFListView+Edit.m */; };
+		C90C6B932A1A0F7300BBE685 /* SignatureCustomPresentationController.h in Headers */ = {isa = PBXBuildFile; fileRef = C90C6B912A1A0F7300BBE685 /* SignatureCustomPresentationController.h */; };
+		C90C6B942A1A0F7300BBE685 /* SignatureCustomPresentationController.m in Sources */ = {isa = PBXBuildFile; fileRef = C90C6B922A1A0F7300BBE685 /* SignatureCustomPresentationController.m */; };
 		C918CE8129F621E200D43974 /* CPDFColorPickerView.h in Headers */ = {isa = PBXBuildFile; fileRef = C918CE7F29F621E200D43974 /* CPDFColorPickerView.h */; };
 		C918CE8229F621E200D43974 /* CPDFColorPickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = C918CE8029F621E200D43974 /* CPDFColorPickerView.m */; };
 		C918CE8429F62D6F00D43974 /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C918CE8329F62D6F00D43974 /* Image.xcassets */; };
@@ -286,6 +288,8 @@
 		4FECFF692A15FBC7008DE530 /* CPDFEditTextSampleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFEditTextSampleView.m; sourceTree = "<group>"; };
 		4FF3E1CF2A064A8100C14F91 /* CPDFListView+Edit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFListView+Edit.m"; sourceTree = "<group>"; };
 		4FF3E1D02A064A8100C14F91 /* CPDFListView+Edit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFListView+Edit.h"; sourceTree = "<group>"; };
+		C90C6B912A1A0F7300BBE685 /* SignatureCustomPresentationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SignatureCustomPresentationController.h; sourceTree = "<group>"; };
+		C90C6B922A1A0F7300BBE685 /* SignatureCustomPresentationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SignatureCustomPresentationController.m; sourceTree = "<group>"; };
 		C918CE7F29F621E200D43974 /* CPDFColorPickerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFColorPickerView.h; sourceTree = "<group>"; };
 		C918CE8029F621E200D43974 /* CPDFColorPickerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFColorPickerView.m; sourceTree = "<group>"; };
 		C918CE8329F62D6F00D43974 /* Image.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Image.xcassets; sourceTree = "<group>"; };
@@ -691,6 +695,8 @@
 				C91BE7E12A048F1A0038F2BC /* CSignatureManager.m */,
 				C91BE7EC2A04AED50038F2BC /* CSignatureDrawView.h */,
 				C91BE7ED2A04AED50038F2BC /* CSignatureDrawView.m */,
+				C90C6B912A1A0F7300BBE685 /* SignatureCustomPresentationController.h */,
+				C90C6B922A1A0F7300BBE685 /* SignatureCustomPresentationController.m */,
 				C91BE7DE2A03CF080038F2BC /* Image.xcassets */,
 			);
 			path = PDFSignature;
@@ -1205,6 +1211,7 @@
 				F32DA17429ED904300E19ECA /* CPDFInfoViewController.h in Headers */,
 				C918CE9629F8BA6200D43974 /* CPDFNoteViewController.h in Headers */,
 				C9AF189229F4D0F300EC4979 /* CPDFAnnotationSampleView.h in Headers */,
+				C90C6B932A1A0F7300BBE685 /* SignatureCustomPresentationController.h in Headers */,
 				C918CEE329FBA41A00D43974 /* CPDFDrawArrowView.h in Headers */,
 				4F06AB5429F6792E007797E4 /* CPDFTextProperty.h in Headers */,
 				F382636B29EFD0D9003F1DFD /* CPDFSlider.h in Headers */,
@@ -1440,6 +1447,7 @@
 				F32DA19229ED908800E19ECA /* CPDFMoreListViewController.m in Sources */,
 				C918CECA29FA140C00D43974 /* CPDFInkViewController.m in Sources */,
 				F382636929EFD0D9003F1DFD /* CPDFPageIndicatorView.m in Sources */,
+				C90C6B942A1A0F7300BBE685 /* SignatureCustomPresentationController.m in Sources */,
 				4FECFF6B2A15FBC7008DE530 /* CPDFEditTextSampleView.m in Sources */,
 				C91BE7DD2A039E900038F2BC /* CPDFSignatureEditViewController.m in Sources */,
 				C9FBA21D2A0E2FB6003FABEC /* CStampButton.m in Sources */,

+ 14 - 4
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFLink/CPDFLinkViewController.m

@@ -36,6 +36,8 @@
 
 @property (nonatomic, assign) CPDFLinkType linkType;
 
+@property (nonatomic, strong) UIView *headerView;
+
 @end
 
 @implementation CPDFLinkViewController
@@ -52,7 +54,13 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     
-    self.view.backgroundColor = [CPDFColorUtils CPDFViewControllerBackgroundColor];
+    self.view.backgroundColor = [CPDFColorUtils CAnnotationSampleBackgoundColor];
+    
+    self.headerView = [[UIView alloc] init];
+    self.headerView.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1].CGColor;
+    self.headerView.layer.borderWidth = 1.0;
+    self.headerView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
+    [self.view addSubview:self.headerView];
 
     [self initWithView];
     
@@ -147,6 +155,8 @@
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
+    self.titleLabel.frame = CGRectMake(0, 17.5, self.view.frame.size.width, 25.0);
+    self.headerView.frame = CGRectMake(0, 0, self.view.frame.size.width, 50);
     
     if (@available(iOS 11.0, *)) {
         self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, 50);
@@ -182,13 +192,13 @@
 #pragma mark - Private
 
 - (void)initWithView {
-    _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 17.5, self.view.frame.size.width, 25.0)];
+    _titleLabel = [[UILabel alloc] init];
     _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
     _titleLabel.text = NSLocalizedString(@"Link to", nil);
     _titleLabel.textAlignment = NSTextAlignmentCenter;
     _titleLabel.font = [UIFont systemFontOfSize:20];
     _titleLabel.adjustsFontSizeToFitWidth = YES;
-    [self.view addSubview:_titleLabel];
+    [self.headerView addSubview:_titleLabel];
     
     _scrcollView = [[UIScrollView alloc] init];
     _scrcollView.frame = CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height);
@@ -205,7 +215,7 @@
     self.backBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
     [self.backBtn setImage:[UIImage imageNamed:@"CPDFAnnotationBaseImageBack" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.backBtn addTarget:self action:@selector(buttonItemClicked_back:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.backBtn];
+    [self.headerView addSubview:self.backBtn];
     
     CGFloat offstY = 10;
     _segmentedControl = [[UISegmentedControl alloc] initWithItems:@[NSLocalizedString(@"URL", nil), NSLocalizedString(@"Page",nil),NSLocalizedString(@"Email",nil)]];

+ 29 - 5
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.m

@@ -30,7 +30,11 @@
 
 @property (nonatomic, strong) CPDFArrowStyleView *startArrowStyleView;
 
-@property (nonatomic ,strong) CPDFArrowStyleView *endArrowStyleView;
+@property (nonatomic, strong) CPDFArrowStyleView *endArrowStyleView;
+
+@property (nonatomic, strong) CPDFDrawArrowView *startDrawView;
+
+@property (nonatomic, strong) CPDFDrawArrowView *endDrawView;
 
 @property (nonatomic, strong) NSMutableArray *dashPattern;
 
@@ -54,11 +58,7 @@
     self.arrowLabel.textColor = [UIColor grayColor];
     self.arrowLabel.font = [UIFont systemFontOfSize:12.0];
     [self.scrcollView addSubview:self.arrowLabel];
-    
-    
-    CPDFDrawArrowView *arrView = [[CPDFDrawArrowView alloc] initWithFrame:CGRectMake(0, 0, 80, 30)];
 
-    
     self.arrowBtn = [[UIButton alloc] init];
     [self.arrowBtn setImage:[UIImage imageNamed:@"CPDFShapeArrowImageStart" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     self.arrowBtn.layer.borderWidth = 1.0;
@@ -67,6 +67,10 @@
     [self.arrowBtn addTarget:self action:@selector(buttonItemClicked_start:) forControlEvents:UIControlEventTouchUpInside];
     [self.scrcollView addSubview:self.arrowBtn];
     
+    self.startDrawView = [[CPDFDrawArrowView alloc] init];
+    self.startDrawView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
+    [self.arrowBtn addSubview:self.startDrawView];
+    
     self.trialLabel = [[UILabel alloc] init];
     self.trialLabel.text = NSLocalizedString(@"Tail Line Style", nil);
     self.trialLabel.textColor = [UIColor grayColor];
@@ -82,6 +86,10 @@
     self.trialBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
     [self.scrcollView addSubview:self.trialBtn];
     
+    self.endDrawView = [[CPDFDrawArrowView alloc]init];
+    self.endDrawView.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
+    [self.trialBtn addSubview:self.endDrawView];
+    
     self.fillColorSelectView.hidden = YES;
     
     self.view.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
@@ -108,9 +116,11 @@
         self.arrowLabel.frame = CGRectMake(self.view.safeAreaInsets.left+20, offsetY, 100, 45);
         self.arrowBtn.frame = CGRectMake(self.view.frame.size.width - 100 - self.view.safeAreaInsets.right, offsetY + 7.5, 80, 30);
         offsetY+= self.arrowLabel.frame.size.height;
+        self.startDrawView.frame = CGRectMake(0, 0, 40, 30);
         
         self.trialLabel.frame = CGRectMake(self.view.safeAreaInsets.left+20, offsetY, 100, 45);
         self.trialBtn.frame = CGRectMake(self.view.frame.size.width - 100- self.view.safeAreaInsets.right, offsetY + 7.5, 80, 30);
+        self.endDrawView.frame = CGRectMake(0, 0, 40, 30);
     } else {
         CGFloat offsetY = 0;
         self.colorView.frame = CGRectMake(0, 0,self.view.frame.size.width, 90);
@@ -127,9 +137,11 @@
         self.arrowLabel.frame = CGRectMake(20, offsetY, 100, 45);
         self.arrowBtn.frame = CGRectMake(self.view.frame.size.width - 100, offsetY + 7.5, 80, 30);
         offsetY+= self.arrowLabel.frame.size.height;
+        self.startDrawView.frame = CGRectMake(0, 0, 40, 30);
         
         self.trialLabel.frame = CGRectMake(20, offsetY, 100, 45);
         self.trialBtn.frame = CGRectMake(self.view.frame.size.width - 100, offsetY + 7.5, 80, 30);
+        self.endDrawView.frame = CGRectMake(0, 0, 40, 30);
     }
 }
 
@@ -151,7 +163,13 @@
     self.sampleView.startArrowStyleIndex = (NSInteger)self.annotStyle.startLineStyle;
     self.sampleView.endArrowStyleIndex = (NSInteger)self.annotStyle.endLineStyle;
     [self.sampleView setNeedsDisplay];
+
+    self.startDrawView.selectIndex = (NSInteger)self.annotStyle.startLineStyle;
+    [self.startDrawView setNeedsDisplay];
+    self.endDrawView.selectIndex = (NSInteger)self.annotStyle.endLineStyle;
+    [self.endDrawView setNeedsDisplay];
 }
+    
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
     if([self.startArrowStyleView superview] || [self.endArrowStyleView superview]) {
@@ -192,6 +210,9 @@
             [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
         }
         [self.sampleView setNeedsDisplay];
+        
+        self.startDrawView.selectIndex = selectIndex;
+        [self.startDrawView setNeedsDisplay];
     } else if (arrowStyleView == self.endArrowStyleView) {
         self.sampleView.endArrowStyleIndex = selectIndex;
         self.annotStyle.endLineStyle = selectIndex;
@@ -199,6 +220,9 @@
             [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
         }
         [self.sampleView setNeedsDisplay];
+        
+        self.endDrawView.selectIndex = selectIndex;
+        [self.endDrawView setNeedsDisplay];
     }
 }
 

+ 18 - 7
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureEditViewController.m

@@ -173,26 +173,37 @@
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
-    self.headerView.frame = CGRectMake(0, 0, self.view.frame.size.width, 150);
+    self.headerView.frame = CGRectMake(0, 0, self.view.frame.size.width, 50);
     self.colorPicker.frame = CGRectMake(0, self.view.frame.size.height/2, self.view.frame.size.width, self.view.frame.size.height/2);
     self.segmentedControl.frame = CGRectMake((self.view.frame.size.width - 220)/2, 10, 220, 30);
     self.emptyLabel.frame = CGRectMake((self.view.frame.size.width - 200)/2, (self.view.frame.size.height - 50)/2, 200, 50);
    
     if (@available(iOS 11.0, *)) {
+        UIInterfaceOrientation currentOrientation = [UIApplication sharedApplication].statusBarOrientation;
+        if (UIInterfaceOrientationIsPortrait(currentOrientation)) {
+            self.colorSelectView.frame = CGRectMake(self.view.safeAreaInsets.left, 50, 380, 60);
+            self.colorSelectView.colorPickerView.frame = CGRectMake(0, 0, self.colorSelectView.frame.size.width, self.colorSelectView.frame.size.height);
+            self.thicknessView.frame = CGRectMake(self.view.safeAreaInsets.left, 140, self.view.frame.size.width-self.view.safeAreaInsets.left-self.view.safeAreaInsets.right, 60);
+            self.thicknessLabel.frame = CGRectMake(20, 15, 60, 30);
+            self.thicknessSlider.frame = CGRectMake(90, 0, self.thicknessView.bounds.size.width-110, 60);
+            self.signatureDrawTextView.frame = CGRectMake(self.view.safeAreaInsets.left, 210, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height-self.view.safeAreaInsets.top-self.view.safeAreaInsets.bottom-150);
+        } else if (UIInterfaceOrientationIsLandscape(currentOrientation)) {
+            self.colorSelectView.frame = CGRectMake(self.view.safeAreaInsets.left, 50, 380, 60);
+            self.thicknessView.frame = CGRectMake(380, 70, self.view.frame.size.width-380-self.view.safeAreaInsets.right, 60);
+            self.thicknessLabel.frame = CGRectMake(20, 15, 60, 30);
+            self.thicknessSlider.frame = CGRectMake(90, 0, self.thicknessView.bounds.size.width-110, 60);
+            self.signatureDrawTextView.frame = CGRectMake(self.view.safeAreaInsets.left, 130, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height-self.view.safeAreaInsets.top-self.view.safeAreaInsets.bottom-130);
+        }
         self.saveButton.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, 40);
         self.cacelButon.frame = CGRectMake( self.view.safeAreaInsets.left+20, 5, 50, 40);
-        self.colorSelectView.frame = CGRectMake(self.view.safeAreaInsets.left, 50, self.view.frame.size.width-self.view.safeAreaInsets.left-self.view.safeAreaInsets.right, 60);
-        self.thicknessView.frame = CGRectMake(self.view.safeAreaInsets.left, 140, self.view.frame.size.width-self.view.safeAreaInsets.left-self.view.safeAreaInsets.right, 60);
-        self.thicknessLabel.frame = CGRectMake(20, 15, 60, 30);
-        self.thicknessSlider.frame = CGRectMake(90, 0, self.thicknessView.bounds.size.width-110, 60);
-        self.signatureDrawTextView.frame = CGRectMake(self.view.safeAreaInsets.left, 210, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height-self.view.safeAreaInsets.top-self.view.safeAreaInsets.bottom-150);
-        
         self.signatureDrawImageView.frame = CGRectMake(self.view.safeAreaInsets.left, 50, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height-self.view.safeAreaInsets.top-self.view.safeAreaInsets.bottom-150);
         self.createButton.frame = CGRectMake(self.view.frame.size.width - 70 - self.view.safeAreaInsets.right, self.view.frame.size.height - 100 - self.view.safeAreaInsets.bottom, 50, 50);
         self.clearButton.frame = CGRectMake(self.view.frame.size.width - 70 - self.view.safeAreaInsets.right, self.view.frame.size.height - 100 - self.view.safeAreaInsets.bottom, 50, 50);
     } else {
         self.colorSelectView.frame = CGRectMake(0, 64, self.view.frame.size.width, 90);
         self.thicknessView.frame = CGRectMake(20, self.view.safeAreaInsets.top, self.view.frame.size.width-40, 90);
+        self.thicknessLabel.frame = CGRectMake(20, 15, 60, 30);
+        self.thicknessSlider.frame = CGRectMake(90, 0, self.thicknessView.bounds.size.width-110, 60);
         self.signatureDrawTextView.frame = CGRectMake(0, 190, self.view.frame.size.width, self.view.frame.size.height/2);
         self.signatureDrawImageView.frame = self.signatureDrawTextView.frame;
         self.createButton.frame = CGRectMake(self.view.frame.size.width - 70, self.view.frame.size.height - 100, 50, 50);

+ 3 - 3
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.m

@@ -15,9 +15,9 @@
 #import "CPDFSignatureViewCell.h"
 #import "CSignatureManager.h"
 #import "CPDFSignatureEditViewController.h"
+#import "SignatureCustomPresentationController.h"
 
 #import <compdfkit_tools/CPDFColorUtils.h>
-#import <compdfkit_tools/AAPLCustomPresentationController.h>
 
 @interface CPDFSignatureViewController () <UITableViewDelegate, UITableViewDataSource, CPDFSignatureViewCellDelegate,CPDFSignatureEditViewControllerDelegate>
 
@@ -148,12 +148,12 @@
 }
 
 - (void)buttonItemClicked_create:(id)sender {
-    AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
+    SignatureCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
     CPDFSignatureEditViewController *editVC = [[CPDFSignatureEditViewController alloc] init];
     
     editVC.delegate = self;
     
-    presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:editVC presentingViewController:self];
+    presentationController = [[SignatureCustomPresentationController alloc] initWithPresentedViewController:editVC presentingViewController:self];
     editVC.transitioningDelegate = presentationController;
     [self presentViewController:editVC animated:YES completion:nil];
 }

+ 16 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/SignatureCustomPresentationController.h

@@ -0,0 +1,16 @@
+//
+//  SignatureCustomPresentationController.h
+//  compdfkit-tools
+//
+//  Created by kdanmobile_2 on 2023/5/21.
+//
+
+#import <compdfkit_tools/compdfkit_tools.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SignatureCustomPresentationController : UIPresentationController <UIViewControllerTransitioningDelegate>
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 362 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/SignatureCustomPresentationController.m

@@ -0,0 +1,362 @@
+//
+//  SignatureCustomPresentationController.m
+//  compdfkit-tools
+//
+//  Created by kdanmobile_2 on 2023/5/21.
+//
+
+#import "SignatureCustomPresentationController.h"
+
+#define CORNER_RADIUS   16.f
+
+@interface SignatureCustomPresentationController () <UIViewControllerAnimatedTransitioning>
+@property (nonatomic, strong) UIView *dimmingView;
+@property (nonatomic, strong) UIView *presentationWrappingView;
+@end
+
+@implementation SignatureCustomPresentationController
+
+- (instancetype)initWithPresentedViewController:(UIViewController *)presentedViewController presentingViewController:(UIViewController *)presentingViewController
+{
+    self = [super initWithPresentedViewController:presentedViewController presentingViewController:presentingViewController];
+    
+    if (self) {
+        presentedViewController.modalPresentationStyle = UIModalPresentationCustom;
+    }
+    
+    return self;
+}
+
+- (UIView*)presentedView
+{
+    // Return the wrapping view created in -presentationTransitionWillBegin.
+    return self.presentationWrappingView;
+}
+
+- (void)presentationTransitionWillBegin
+{
+    // The default implementation of -presentedView returns
+    // self.presentedViewController.view.
+    UIView *presentedViewControllerView = [super presentedView];
+    
+    // Wrap the presented view controller's view in an intermediate hierarchy
+    // that applies a shadow and rounded corners to the top-left and top-right
+    // edges.  The final effect is built using three intermediate views.
+    //
+    // presentationWrapperView              <- shadow
+    //   |- presentationRoundedCornerView   <- rounded corners (masksToBounds)
+    //        |- presentedViewControllerWrapperView
+    //             |- presentedViewControllerView (presentedViewController.view)
+    //
+    // SEE ALSO: The note in AAPLCustomPresentationSecondViewController.m.
+    {
+        UIView *presentationWrapperView = [[UIView alloc] initWithFrame:self.frameOfPresentedViewInContainerView];
+        presentationWrapperView.layer.shadowOpacity = 0.44f;
+        presentationWrapperView.layer.shadowRadius = 13.f;
+        presentationWrapperView.layer.shadowOffset = CGSizeMake(0, -6.f);
+        self.presentationWrappingView = presentationWrapperView;
+        
+        // presentationRoundedCornerView is CORNER_RADIUS points taller than the
+        // height of the presented view controller's view.  This is because
+        // the cornerRadius is applied to all corners of the view.  Since the
+        // effect calls for only the top two corners to be rounded we size
+        // the view such that the bottom CORNER_RADIUS points lie below
+        // the bottom edge of the screen.
+        UIView *presentationRoundedCornerView = [[UIView alloc] initWithFrame:UIEdgeInsetsInsetRect(presentationWrapperView.bounds, UIEdgeInsetsMake(0, 0, -CORNER_RADIUS, 0))];
+        presentationRoundedCornerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+        presentationRoundedCornerView.layer.cornerRadius = CORNER_RADIUS;
+        presentationRoundedCornerView.layer.masksToBounds = YES;
+        
+        // To undo the extra height added to presentationRoundedCornerView,
+        // presentedViewControllerWrapperView is inset by CORNER_RADIUS points.
+        // This also matches the size of presentedViewControllerWrapperView's
+        // bounds to the size of -frameOfPresentedViewInContainerView.
+        UIView *presentedViewControllerWrapperView = [[UIView alloc] initWithFrame:UIEdgeInsetsInsetRect(presentationRoundedCornerView.bounds, UIEdgeInsetsMake(0, 0, CORNER_RADIUS, 0))];
+        presentedViewControllerWrapperView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+        
+        // Add presentedViewControllerView -> presentedViewControllerWrapperView.
+        presentedViewControllerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+        presentedViewControllerView.frame = presentedViewControllerWrapperView.bounds;
+        [presentedViewControllerWrapperView addSubview:presentedViewControllerView];
+        
+        // Add presentedViewControllerWrapperView -> presentationRoundedCornerView.
+        [presentationRoundedCornerView addSubview:presentedViewControllerWrapperView];
+        
+        // Add presentationRoundedCornerView -> presentationWrapperView.
+        [presentationWrapperView addSubview:presentationRoundedCornerView];
+    }
+    
+    // Add a dimming view behind presentationWrapperView.  self.presentedView
+    // is added later (by the animator) so any views added here will be
+    // appear behind the -presentedView.
+    {
+        UIView *dimmingView = [[UIView alloc] initWithFrame:self.containerView.bounds];
+        dimmingView.backgroundColor = [UIColor blackColor];
+        dimmingView.opaque = NO;
+        dimmingView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+        [dimmingView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dimmingViewTapped:)]];
+        self.dimmingView = dimmingView;
+        [self.containerView addSubview:dimmingView];
+        
+        // Get the transition coordinator for the presentation so we can
+        // fade in the dimmingView alongside the presentation animation.
+        id<UIViewControllerTransitionCoordinator> transitionCoordinator = self.presentingViewController.transitionCoordinator;
+        
+        self.dimmingView.alpha = 0.f;
+        [transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
+            self.dimmingView.alpha = 0.5f;
+        } completion:NULL];
+    }
+}
+
+- (void)presentationTransitionDidEnd:(BOOL)completed
+{
+    // The value of the 'completed' argument is the same value passed to the
+    // -completeTransition: method by the animator.  It may
+    // be NO in the case of a cancelled interactive transition.
+    if (completed == NO)
+    {
+        // The system removes the presented view controller's view from its
+        // superview and disposes of the containerView.  This implicitly
+        // removes the views created in -presentationTransitionWillBegin: from
+        // the view hierarchy.  However, we still need to relinquish our strong
+        // references to those view.
+        self.presentationWrappingView = nil;
+        self.dimmingView = nil;
+    }
+}
+
+- (void)dismissalTransitionWillBegin
+{
+    // Get the transition coordinator for the dismissal so we can
+    // fade out the dimmingView alongside the dismissal animation.
+    id<UIViewControllerTransitionCoordinator> transitionCoordinator = self.presentingViewController.transitionCoordinator;
+    
+    [transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
+        self.dimmingView.alpha = 0.f;
+    } completion:NULL];
+}
+
+- (void)dismissalTransitionDidEnd:(BOOL)completed
+{
+    // The value of the 'completed' argument is the same value passed to the
+    // -completeTransition: method by the animator.  It may
+    // be NO in the case of a cancelled interactive transition.
+    if (completed == YES)
+    {
+        // The system removes the presented view controller's view from its
+        // superview and disposes of the containerView.  This implicitly
+        // removes the views created in -presentationTransitionWillBegin: from
+        // the view hierarchy.  However, we still need to relinquish our strong
+        // references to those view.
+        self.presentationWrappingView = nil;
+        self.dimmingView = nil;
+    }
+}
+
+#pragma mark -
+#pragma mark Layout
+
+//  This method is invoked whenever the presentedViewController's
+//  preferredContentSize property changes.  It is also invoked just before the
+//  presentation transition begins (prior to -presentationTransitionWillBegin).
+//
+- (void)preferredContentSizeDidChangeForChildContentContainer:(id<UIContentContainer>)container
+{
+    [super preferredContentSizeDidChangeForChildContentContainer:container];
+    
+    if (container == self.presentedViewController)
+        [self.containerView setNeedsLayout];
+}
+
+
+//  When the presentation controller receives a
+//  -viewWillTransitionToSize:withTransitionCoordinator: message it calls this
+//  method to retrieve the new size for the presentedViewController's view.
+//  The presentation controller then sends a
+//  -viewWillTransitionToSize:withTransitionCoordinator: message to the
+//  presentedViewController with this size as the first argument.
+//
+//  Note that it is up to the presentation controller to adjust the frame
+//  of the presented view controller's view to match this promised size.
+//  We do this in -containerViewWillLayoutSubviews.
+//
+- (CGSize)sizeForChildContentContainer:(id<UIContentContainer>)container withParentContainerSize:(CGSize)parentSize
+{
+    if (container == self.presentedViewController)
+        return ((UIViewController*)container).preferredContentSize;
+    else
+        return [super sizeForChildContentContainer:container withParentContainerSize:parentSize];
+}
+
+- (CGRect)frameOfPresentedViewInContainerView
+{
+    CGRect containerViewBounds = self.containerView.bounds;
+    CGSize presentedViewContentSize = [self sizeForChildContentContainer:self.presentedViewController withParentContainerSize:containerViewBounds.size];
+    
+    // The presented view extends presentedViewContentSize.height points from
+    // the bottom edge of the screen.
+    CGRect presentedViewControllerFrame = containerViewBounds;
+    presentedViewControllerFrame.size.height = presentedViewContentSize.height;
+    presentedViewControllerFrame.origin.y = CGRectGetMaxY(containerViewBounds) - presentedViewContentSize.height;
+    return presentedViewControllerFrame;
+}
+
+//  This method is similar to the -viewWillLayoutSubviews method in
+//  UIViewController.  It allows the presentation controller to alter the
+//  layout of any custom views it manages.
+//
+- (void)containerViewWillLayoutSubviews
+{
+    [super containerViewWillLayoutSubviews];
+    
+    self.dimmingView.frame = self.containerView.bounds;
+//    self.frameOfPresentedViewInContainerView
+    CGFloat width = self.containerView.frame.size.width;
+    self.presentationWrappingView.frame =  CGRectMake((self.frameOfPresentedViewInContainerView.size.width - width)/2, self.frameOfPresentedViewInContainerView.origin.y,width, self.frameOfPresentedViewInContainerView.size.height);
+}
+
+#pragma mark -
+#pragma mark Tap Gesture Recognizer
+
+//  IBAction for the tap gesture recognizer added to the dimmingView.
+//  Dismisses the presented view controller.
+//
+- (IBAction)dimmingViewTapped:(UITapGestureRecognizer*)sender
+{
+    [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
+}
+
+#pragma mark -
+#pragma mark UIViewControllerAnimatedTransitioning
+
+- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext
+{
+    return [transitionContext isAnimated] ? 0.35 : 0;
+}
+
+//  The presentation animation is tightly integrated with the overall
+//  presentation so it makes the most sense to implement
+//  <UIViewControllerAnimatedTransitioning> in the presentation controller
+//  rather than in a separate object.
+//
+- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
+{
+    UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
+    UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
+    
+    UIView *containerView = transitionContext.containerView;
+    
+    // For a Presentation:
+    //      fromView = The presenting view.
+    //      toView   = The presented view.
+    // For a Dismissal:
+    //      fromView = The presented view.
+    //      toView   = The presenting view.
+    UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey];
+    // If NO is returned from -shouldRemovePresentersView, the view associated
+    // with UITransitionContextFromViewKey is nil during presentation.  This
+    // intended to be a hint that your animator should NOT be manipulating the
+    // presenting view controller's view.  For a dismissal, the -presentedView
+    // is returned.
+    //
+    // Why not allow the animator manipulate the presenting view controller's
+    // view at all times?  First of all, if the presenting view controller's
+    // view is going to stay visible after the animation finishes during the
+    // whole presentation life cycle there is no need to animate it at all — it
+    // just stays where it is.  Second, if the ownership for that view
+    // controller is transferred to the presentation controller, the
+    // presentation controller will most likely not know how to layout that
+    // view controller's view when needed, for example when the orientation
+    // changes, but the original owner of the presenting view controller does.
+    UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
+    
+    BOOL isPresenting = (fromViewController == self.presentingViewController);
+    
+    // This will be the current frame of fromViewController.view.
+    CGRect __unused fromViewInitialFrame = [transitionContext initialFrameForViewController:fromViewController];
+    // For a presentation which removes the presenter's view, this will be
+    // CGRectZero.  Otherwise, the current frame of fromViewController.view.
+    CGRect fromViewFinalFrame = [transitionContext finalFrameForViewController:fromViewController];
+    // This will be CGRectZero.
+    CGRect toViewInitialFrame = [transitionContext initialFrameForViewController:toViewController];
+    // For a presentation, this will be the value returned from the
+    // presentation controller's -frameOfPresentedViewInContainerView method.
+    CGRect toViewFinalFrame = [transitionContext finalFrameForViewController:toViewController];
+    
+    // We are responsible for adding the incoming view to the containerView
+    // for the presentation (will have no effect on dismissal because the
+    // presenting view controller's view was not removed).
+    [containerView addSubview:toView];
+    
+    if (isPresenting) {
+        toViewInitialFrame.origin = CGPointMake(CGRectGetMinX(containerView.bounds), CGRectGetMaxY(containerView.bounds));
+        toViewInitialFrame.size = toViewFinalFrame.size;
+        toView.frame = toViewInitialFrame;
+    } else {
+        // Because our presentation wraps the presented view controller's view
+        // in an intermediate view hierarchy, it is more accurate to rely
+        // on the current frame of fromView than fromViewInitialFrame as the
+        // initial frame (though in this example they will be the same).
+        fromViewFinalFrame = CGRectOffset(fromView.frame, 0, CGRectGetHeight(fromView.frame));
+    }
+    
+    NSTimeInterval transitionDuration = [self transitionDuration:transitionContext];
+    
+    [UIView animateWithDuration:transitionDuration animations:^{
+        if (isPresenting)
+            toView.frame = toViewFinalFrame;
+        else
+            fromView.frame = fromViewFinalFrame;
+        
+    } completion:^(BOOL finished) {
+        // When we complete, tell the transition context
+        // passing along the BOOL that indicates whether the transition
+        // finished or not.
+        BOOL wasCancelled = [transitionContext transitionWasCancelled];
+        [transitionContext completeTransition:!wasCancelled];
+    }];
+}
+
+#pragma mark -
+#pragma mark UIViewControllerTransitioningDelegate
+
+//  If the modalPresentationStyle of the presented view controller is
+//  UIModalPresentationCustom, the system calls this method on the presented
+//  view controller's transitioningDelegate to retrieve the presentation
+//  controller that will manage the presentation.  If your implementation
+//  returns nil, an instance of UIPresentationController is used.
+//
+- (UIPresentationController*)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source
+{
+    NSAssert(self.presentedViewController == presented, @"You didn't initialize %@ with the correct presentedViewController.  Expected %@, got %@.",
+             self, presented, self.presentedViewController);
+    
+    return self;
+}
+
+//  The system calls this method on the presented view controller's
+//  transitioningDelegate to retrieve the animator object used for animating
+//  the presentation of the incoming view controller.  Your implementation is
+//  expected to return an object that conforms to the
+//  UIViewControllerAnimatedTransitioning protocol, or nil if the default
+//  presentation animation should be used.
+//
+- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source
+{
+    return self;
+}
+
+//  The system calls this method on the presented view controller's
+//  transitioningDelegate to retrieve the animator object used for animating
+//  the dismissal of the presented view controller.  Your implementation is
+//  expected to return an object that conforms to the
+//  UIViewControllerAnimatedTransitioning protocol, or nil if the default
+//  dismissal animation should be used.
+//
+- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
+{
+    return self;
+}
+
+@end

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

@@ -34,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) UILabel *colorLabel;
 
+@property (nonatomic, strong) UIScrollView *colorPickerView;
+
 
 @end
 

+ 0 - 2
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFColorSelectView.m

@@ -16,8 +16,6 @@
 
 @interface  CPDFColorSelectView ()
 
-@property (nonatomic, strong) UIScrollView *colorPickerView;
-
 @property (nonatomic, strong) NSMutableArray *colorArray;
 
 @property (nonatomic, strong) NSMutableArray *buttonArray;