Просмотр исходного кода

PDFTools(iOS) - freeText注释优化

yangliuhua 1 год назад
Родитель
Сommit
e7f5a37292
52 измененных файлов с 1624 добавлено и 221 удалено
  1. 0 2
      Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/CPDFViewController.m
  2. 6 1
      Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/main.m
  3. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFAnnotationManage/CAnnotationManage.m
  4. 17 11
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFBase/CPDFAnnotationBaseViewController.m
  5. 2 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFBase/CPDFAnnotationBaseViewController_Header.h
  6. 13 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/CPDFFreeTextViewController.h
  7. 154 29
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/CPDFFreeTextViewController.m
  8. 0 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageBold.imageset/BoldNormal.svg
  9. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageBold.imageset/Contents.json
  10. 118 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageBold.imageset/Item.pdf
  11. 0 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageCenter.imageset/AligmentCenter.svg
  12. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageCenter.imageset/Contents.json
  13. 83 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageCenter.imageset/Segmented Item.pdf
  14. 0 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageLeft.imageset/AlignmentLeft.svg
  15. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageLeft.imageset/Contents.json
  16. 96 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageLeft.imageset/Segmented Item.pdf
  17. 0 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageRight.imageset/AlignmentRight.svg
  18. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageRight.imageset/Contents.json
  19. 95 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageRight.imageset/Segmented Item.pdf
  20. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageUnderline.imageset/Contents.json
  21. 0 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageUnderline.imageset/ItalicNormal.svg
  22. 79 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageUnderline.imageset/Item.pdf
  23. 21 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkTopToolBar.h
  24. 70 13
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkTopToolBar.m
  25. 13 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkViewController.h
  26. 55 3
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkViewController.m
  27. 1 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/Contents.json
  28. BIN
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/btn_eraser_00.png
  29. BIN
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/btn_eraser_00@2x.png
  30. 109 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/eraser.pdf
  31. 1 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/Contents.json
  32. BIN
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/btn_redo.png
  33. BIN
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/btn_redo@2x.png
  34. 84 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/redo.pdf
  35. 1 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInk.imageset/Contents.json
  36. 101 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageSetting.imageset/Union.pdf
  37. 1 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/Contents.json
  38. BIN
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/btn_undo.png
  39. BIN
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/btn_undo@2x.png
  40. 84 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/undo.pdf
  41. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFNote/CPDFNoteViewController.m
  42. 13 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.h
  43. 134 31
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.m
  44. 1 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeCircleViewController.h
  45. 47 22
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeCircleViewController.m
  46. 5 0
      compdfkit-tools/compdfkit-tools/Common/Model/CAnnotStyle.m
  47. 108 19
      compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m
  48. 13 2
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFAnnotationSampleView.h
  49. 81 61
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFAnnotationSampleView.m
  50. 2 1
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFColorSelectView.m
  51. 4 3
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFOpacitySliderView.m
  52. 5 3
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFThicknessSliderView.m

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

@@ -199,8 +199,6 @@
     } else if ([annotation isKindOfClass:[CPDFLinkAnnotation class]]) {
         
     }
-//    [self.annotationManage setAnnotStyleFromAnnotations:self.pdfListView.activeAnnotations];
-    [self.annotationManage setAnnotStyleFromAnnotation:annotation];
 }
 
 #pragma mark - CPDFListViewDelegate

+ 6 - 1
Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/main.m

@@ -2,7 +2,12 @@
 //  main.m
 //  Annotation-Ctrl-Demo
 //
-//  Created by kdanmobile_2 on 2023/4/21.
+//  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+//
+//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+//  This notice may not be removed from this file.
 //
 
 #import <UIKit/UIKit.h>

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFAnnotationManage/CAnnotationManage.m

@@ -39,7 +39,7 @@
 #pragma mark - Publice Methods
 
 - (void)setAnnotStyleFromAnnotations:(NSArray<CPDFAnnotation *> *)annotations {
-    self.annotStyle = [[CAnnotStyle alloc] initWithAnnotionMode:CPDFViewAnnotationModeNote annotations:annotations];
+    self.annotStyle = [[CAnnotStyle alloc] initWithAnnotionMode:CPDFViewAnnotationModeNone annotations:annotations];
 }
 
 - (void)refreshPageWithAnnotations:(NSArray *)annotations {

+ 17 - 11
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFBase/CPDFAnnotationBaseViewController.m

@@ -39,6 +39,10 @@
     self.titleLabel.adjustsFontSizeToFitWidth = YES;
     [self.view addSubview:self.titleLabel];
     
+    self.scrcollView = [[UIScrollView alloc] init];
+    self.scrcollView.scrollEnabled = YES;
+    [self.view addSubview:self.scrcollView];
+    
     self.backBtn = [[UIButton alloc] init];
     self.backBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
     [self.backBtn setImage:[UIImage imageNamed:@"CPDFAnnotationBaseImageBack" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
@@ -50,17 +54,17 @@
     self.sampleView.layer.borderColor = [UIColor purpleColor].CGColor;
     self.sampleView.layer.borderWidth = 1.0;
     self.sampleView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
-    [self.view addSubview:self.sampleView];
+    [self.scrcollView addSubview:self.sampleView];
     
     self.colorView = [[CPDFColorSelectView alloc] init];
     self.colorView.delegate = self;
     self.colorView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [self.view addSubview:self.colorView];
+    [self.scrcollView addSubview:self.colorView];
     
     self.opacitySliderView = [[CPDFOpacitySliderView alloc] init];
     self.opacitySliderView.delegate = self;
     self.opacitySliderView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [self.view addSubview:self.opacitySliderView];
+    [self.scrcollView addSubview:self.opacitySliderView];
     
     self.view.backgroundColor = [UIColor whiteColor];
     [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
@@ -68,19 +72,21 @@
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
-    self.titleLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, 5, 120, ((self.view.frame.size.height)/9));
-    self.sampleView.frame  = CGRectMake((self.view.frame.size.width - 300)/2, ((self.view.frame.size.height)/9), 300, ((self.view.frame.size.height)/9)*3);
+    self.titleLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, 5, 120, 50);
+    self.scrcollView.frame = CGRectMake(0, 50, self.view.frame.size.width, 330);
+    self.scrcollView.contentSize = CGSizeMake(self.view.frame.size.width, 420);
+    self.sampleView.frame  = CGRectMake((self.view.frame.size.width - 300)/2, ((self.view.frame.size.height)/9)*0, 300, 120);
     
     if (@available(iOS 11.0, *)) {
         self.colorPicker.frame = CGRectMake(self.view.safeAreaInsets.left, 0, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height);
-        self.colorView.frame = CGRectMake(self.view.safeAreaInsets.left, ((self.view.frame.size.height)/9)*4,self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, ((self.view.frame.size.height)/9)*2);
-        self.opacitySliderView.frame = CGRectMake(self.view.safeAreaInsets.left, ((self.view.frame.size.height)/9)*6, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, ((self.view.frame.size.height)/9)*2);
+        self.colorView.frame = CGRectMake(self.view.safeAreaInsets.left, 120,self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.opacitySliderView.frame = CGRectMake(self.view.safeAreaInsets.left, 210, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
         self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, ((self.view.frame.size.height)/9));
     } else {
         self.colorPicker.frame = self.view.frame;
-        self.colorView.frame = CGRectMake(0, ((self.view.frame.size.height)/9)*4, self.view.frame.size.width, ((self.view.frame.size.height)/9)*2);
-        self.opacitySliderView.frame = CGRectMake(0, ((self.view.frame.size.height)/9)*6, self.view.frame.size.width, ((self.view.frame.size.height)/9)*2);
-        self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, ((self.view.frame.size.height)/9));
+        self.colorView.frame = CGRectMake(0, ((self.view.frame.size.height)/9)*3, self.view.frame.size.width, ((self.view.frame.size.height)/9)*2);
+        self.opacitySliderView.frame = CGRectMake(0, ((self.view.frame.size.height)/9)*5, self.view.frame.size.width, ((self.view.frame.size.height)/9)*2);
+        self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, 50);
     }
 }
 
@@ -110,7 +116,7 @@
 }
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 270 : 420);
+    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 420);
 }
 
 #pragma mark - Action

+ 2 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFBase/CPDFAnnotationBaseViewController_Header.h

@@ -24,6 +24,8 @@
 
 @property (nonatomic, strong) CPDFColorPickerView *colorPicker;
 
+@property (nonatomic, strong) UIScrollView *scrcollView;
+
 @property (nonatomic, strong) UIButton *backBtn;
 
 @property (nonatomic, strong) UILabel *titleLabel;

+ 13 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/CPDFFreeTextViewController.h

@@ -14,8 +14,21 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class CPDFFreeTextViewController;
+@class CAnnotStyle;
+
+@protocol CPDFFreeTextViewControllerDelegate <NSObject>
+
+@optional
+
+- (void)freeTextViewController:(CPDFFreeTextViewController *)freeTextViewController annotStyle:(CAnnotStyle *)annotStyle;
+
+@end
+
 @interface CPDFFreeTextViewController : CPDFAnnotationBaseViewController
 
+@property (nonatomic, weak) id<CPDFFreeTextViewControllerDelegate> delegate;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 154 - 29
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/CPDFFreeTextViewController.m

@@ -35,7 +35,9 @@
 
 @property (nonatomic, assign) BOOL isBold;
 
-@property (nonatomic, assign) BOOL isUnderline;
+@property (nonatomic, assign) BOOL isItalic;
+
+@property (nonatomic, assign) NSString *baseName;
 
 @property (nonatomic, strong) CPDFFontStyleTableView *fontStyleTableView;
 
@@ -52,37 +54,37 @@
     [self.fontStyleBtn setTitle:NSLocalizedString(@"Font Style", nil) forState:UIControlStateNormal];
     [self.fontStyleBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
     [self.fontStyleBtn addTarget:self action:@selector(buttonItemClicked_FontStyle:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.fontStyleBtn];
+    [self.scrcollView addSubview:self.fontStyleBtn];
     
     self.boldBtn = [[UIButton alloc] init];
     [self.boldBtn setImage:[UIImage imageNamed:@"CPDFFreeTextImageBold" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.boldBtn addTarget:self action:@selector(buttonItemClicked_Bold:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.boldBtn];
+    [self.scrcollView addSubview:self.boldBtn];
     
     self.underlineBtn = [[UIButton alloc] init];
     [self.underlineBtn setImage:[UIImage imageNamed:@"CPDFFreeTextImageUnderline" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
-    [self.underlineBtn addTarget:self action:@selector(buttonItemClicked_Underline:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.underlineBtn];
+    [self.underlineBtn addTarget:self action:@selector(buttonItemClicked_Italic:) forControlEvents:UIControlEventTouchUpInside];
+    [self.scrcollView addSubview:self.underlineBtn];
     
     self.alignmentLabel = [[UILabel alloc] init];
     self.alignmentLabel.text = NSLocalizedString(@"Alignment Mode", nil);
     self.alignmentLabel.adjustsFontSizeToFitWidth = YES;
-    [self.view addSubview:self.alignmentLabel];
+    [self.scrcollView addSubview:self.alignmentLabel];
     
     self.leftBtn = [[UIButton alloc] init];
     [self.leftBtn setImage:[UIImage imageNamed:@"CPDFFreeTextImageLeft" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.leftBtn addTarget:self action:@selector(buttonItemClicked_Left:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.leftBtn];
+    [self.scrcollView addSubview:self.leftBtn];
     
     self.centerBtn = [[UIButton alloc] init];
     [self.centerBtn setImage:[UIImage imageNamed:@"CPDFFreeTextImageCenter" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.centerBtn addTarget:self action:@selector(buttonItemClicked_Center:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.centerBtn];
+    [self.scrcollView addSubview:self.centerBtn];
     
     self.rightBtn = [[UIButton alloc] init];
     [self.rightBtn setImage:[UIImage imageNamed:@"CPDFFreeTextImageRight" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.rightBtn addTarget:self action:@selector(buttonItemClicked_Right:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.rightBtn];
+    [self.scrcollView addSubview:self.rightBtn];
     
     self.fontsizeSliderView = [[CPDFThicknessSliderView alloc] init];
     self.fontsizeSliderView.thicknessSlider.value = 20;
@@ -90,25 +92,39 @@
     self.fontsizeSliderView.thicknessSlider.maximumValue = 100;
     self.fontsizeSliderView.titleLabel.text = NSLocalizedString(@"Font Size", nil);
     self.fontsizeSliderView.startLabel.text = @"1";
-    self.fontsizeSliderView.endLabel.text = @"100";
     self.fontsizeSliderView.delegate = self;
     self.fontsizeSliderView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [self.view addSubview:self.fontsizeSliderView];
+    [self.scrcollView addSubview:self.fontsizeSliderView];
     
     self.isBold = NO;
-    self.isUnderline = NO;
+    self.isItalic = NO;
+    self.baseName = @"Helvetica";
 }
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
-    self.fontStyleBtn.frame = CGRectMake(10, 370, 180, 45);
-    self.boldBtn.frame = CGRectMake(self.view.frame.size.width - 80, 385, 30, 30);
-    self.underlineBtn.frame = CGRectMake(self.view.frame.size.width - 40, 385, 30, 30);
-    self.alignmentLabel.frame = CGRectMake(10, 415, 120, 45);
-    self.leftBtn.frame = CGRectMake(self.view.frame.size.width - 120, 430, 30, 30);
-    self.centerBtn.frame = CGRectMake(self.view.frame.size.width - 80, 430, 30, 30);
-    self.rightBtn.frame = CGRectMake(self.view.frame.size.width - 40, 430, 30, 30);
-    self.fontsizeSliderView.frame = CGRectMake(10, 450, self.view.frame.size.width - 20, 90);
+    self.scrcollView.frame = CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height-50);
+    self.scrcollView.contentSize = CGSizeMake(self.view.frame.size.width, 600);
+    
+    if (@available(iOS 11.0, *)) {
+        self.fontStyleBtn.frame = CGRectMake(self.view.safeAreaInsets.left, 300, 180, 45);
+        self.boldBtn.frame = CGRectMake(self.view.frame.size.width - 80 - self.view.safeAreaInsets.right, 315, 30, 30);
+        self.underlineBtn.frame = CGRectMake(self.view.frame.size.width - 40 - self.view.safeAreaInsets.right, 315, 30, 30);
+        self.alignmentLabel.frame = CGRectMake(self.view.safeAreaInsets.left, 345, 120, 45);
+        self.leftBtn.frame = CGRectMake(self.view.frame.size.width - 120 - self.view.safeAreaInsets.right, 360, 30, 30);
+        self.centerBtn.frame = CGRectMake(self.view.frame.size.width - 80 - self.view.safeAreaInsets.right, 360, 30, 30);
+        self.rightBtn.frame = CGRectMake(self.view.frame.size.width - 40, 360, 30, 30);
+        self.fontsizeSliderView.frame = CGRectMake(self.view.safeAreaInsets.left, 400, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+    } else {
+        self.fontStyleBtn.frame = CGRectMake(10, 300, 180, 45);
+        self.boldBtn.frame = CGRectMake(self.view.frame.size.width - 80, 315, 30, 30);
+        self.underlineBtn.frame = CGRectMake(self.view.frame.size.width - 40, 315, 30, 30);
+        self.alignmentLabel.frame = CGRectMake(10, 345, 120, 45);
+        self.leftBtn.frame = CGRectMake(self.view.frame.size.width - 120, 360, 30, 30);
+        self.centerBtn.frame = CGRectMake(self.view.frame.size.width - 80, 360, 30, 30);
+        self.rightBtn.frame = CGRectMake(self.view.frame.size.width - 40, 360, 30, 30);
+        self.fontsizeSliderView.frame = CGRectMake(10, 480, self.view.frame.size.width - 20, 90);
+    }
 }
 
 #pragma mark - Protect Mehtods
@@ -116,13 +132,70 @@
 - (void)commomInitTitle {
     self.titleLabel.text = NSLocalizedString(@"Free Text", nil);
     self.sampleView.selecIndex = CPDFSamplesFreeText;
-    self.sampleView.fontName = @"Helvetica";
     self.sampleView.fillColor = [UIColor blueColor];
-    self.sampleView.thickness = 20;
 }
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 270 : 600);
+    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 600);
+}
+
+- (void)commomInitFromAnnotStyle {
+    self.sampleView.fillColor = self.annotStyle.color;
+    self.sampleView.opcity = self.annotStyle.opacity;
+    self.sampleView.thickness = self.annotStyle.fontSize;
+    self.fontsizeSliderView.thicknessSlider.value = self.annotStyle.fontSize;
+    [self analyzeFont:self.annotStyle.fontName];
+    [self.sampleView setNeedsDisplay];
+}
+
+#pragma mark - Private
+
+- (void)analyzeFont:(NSString *)fontName {
+    if ([fontName rangeOfString:@"Bold"].location != NSNotFound) {
+        self.isBold = YES;
+        self.sampleView.isBold = self.isBold;
+    }
+    if ([fontName rangeOfString:@"Italic"].location != NSNotFound) {
+        self.isItalic = YES;
+        self.sampleView.isItalic = self.isItalic;
+    }
+    if ([fontName rangeOfString:@"Helvetica"].location != NSNotFound)
+    {
+        self.baseName = @"Helvetica";
+        self.sampleView.fontName = self.baseName;
+        return ;
+    }
+    if ([fontName rangeOfString:@"Courier"].location != NSNotFound)
+    {
+        self.baseName = @"Courier";
+        self.sampleView.fontName = self.baseName;
+        return ;
+    }
+    if ([fontName rangeOfString:@"Times"].location != NSNotFound)
+    {
+        self.baseName = @"Times-Roman";
+        self.sampleView.fontName = self.baseName;
+    }
+}
+
+- (NSString *)constructionFontname:(NSString *)baseName isBold:(BOOL)isBold isItalic:(BOOL)isItalic {
+    NSString *result;
+    if ([baseName rangeOfString:@"Times"].location != NSNotFound) {
+       if (isBold || isItalic) {
+           if (isBold && isItalic) return @"Times-BoldItalic";
+           if (isBold) return @"Times-Bold";
+           if (isItalic) return @"Times-Italic";
+       }
+       else
+           return @"Times-Roman";
+    }
+    if (isBold || isItalic) {
+       result = [NSString stringWithFormat:@"%@-",baseName];
+       if (isBold) result = [NSString stringWithFormat:@"%@Bold",result];
+       if (isItalic) result = [NSString stringWithFormat:@"%@Oblique",result];
+    }
+    else return baseName;
+    return result;
 }
 
 #pragma mark - Action
@@ -131,12 +204,21 @@
     self.isBold = !(self.isBold);
     self.sampleView.isBold = self.isBold;
     [self.sampleView setNeedsDisplay];
+    self.annotStyle.fontName = [self constructionFontname:self.baseName isBold:self.isBold isItalic:self.isItalic];
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
 }
 
-- (void)buttonItemClicked_Underline:(id)sender {
-    self.isUnderline = !(self.isUnderline);
-    self.sampleView.isUnderline = self.isUnderline;
+- (void)buttonItemClicked_Italic:(id)sender {
+    self.isItalic = !(self.isItalic);
+    self.sampleView.isItalic = self.isItalic;
     [self.sampleView setNeedsDisplay];
+    self.annotStyle.fontName = [self constructionFontname:self.baseName isBold:self.isBold isItalic:self.isItalic];
+    
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
 }
 
 - (void)buttonItemClicked_FontStyle:(id)sender {
@@ -144,24 +226,40 @@
     self.fontStyleTableView.delegate = self;
     self.fontStyleTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self.view addSubview:self.fontStyleTableView];
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
 }
 
 - (void)buttonItemClicked_Left:(id)sender {
-    
+    self.annotStyle.alignment = NSTextAlignmentLeft;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
 }
 
 - (void)buttonItemClicked_Center:(id)sender {
-    
+    self.annotStyle.alignment = NSTextAlignmentCenter;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
 }
 
 - (void)buttonItemClicked_Right:(id)sender {
-    
+    self.annotStyle.alignment = NSTextAlignmentRight;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
 }
 
 #pragma mark - CPDFThicknessSliderViewDelegate
 
 - (void)thicknessSliderView:(CPDFThicknessSliderView *)thicknessSliderView thickness:(CGFloat)thickness {
     self.sampleView.thickness = thickness;
+    self.annotStyle.fontSize = self.fontsizeSliderView.thicknessSlider.value;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
     [self.sampleView setNeedsDisplay];
 }
 
@@ -169,6 +267,33 @@
 
 - (void)fontStyleTableView:(CPDFFontStyleTableView *)fontStyleTableView fontName:(NSString *)fontName {
     self.sampleView.fontName = fontName;
+    self.baseName = fontName;
+    self.annotStyle.fontName = [self constructionFontname:self.baseName isBold:self.isBold isItalic:self.isItalic];
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
+}
+
+#pragma mark - CPDFColorSelectViewDelegate
+
+- (void)selectColorView:(CPDFColorSelectView *)select color:(UIColor *)color {
+    self.sampleView.fillColor = color;
+    self.annotStyle.color = color;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
+}
+
+#pragma mark - CPDFColorPickerViewDelegate
+
+- (void)pickerView:(CPDFColorPickerView *)colorPickerView color:(UIColor *)color {
+    self.sampleView.fillColor = color;
+    self.annotStyle.color = color;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(freeTextViewController:annotStyle:)]) {
+        [self.delegate freeTextViewController:self annotStyle:self.annotStyle];
+    }
     [self.sampleView setNeedsDisplay];
 }
 

Разница между файлами не показана из-за своего большого размера
+ 0 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageBold.imageset/BoldNormal.svg


+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageBold.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "BoldNormal.svg",
+      "filename" : "Item.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },

+ 118 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageBold.imageset/Item.pdf

@@ -0,0 +1,118 @@
+%PDF-1.7
+
+1 0 obj
+  << /ExtGState << /E1 << /ca 0.200000 >> >> >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+/E1 gs
+1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
+0.286275 0.509804 0.901961 scn
+0.000000 32.000000 m
+40.000000 32.000000 l
+40.000000 0.000000 l
+0.000000 0.000000 l
+0.000000 32.000000 l
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 14.628906 9.000000 cm
+0.286275 0.509804 0.901961 scn
+8.751858 7.259878 m
+8.876074 7.308465 8.992642 7.362464 9.101562 7.421875 c
+9.680989 7.740885 10.094401 8.154297 10.341797 8.662109 c
+10.589192 9.169922 10.712891 9.713541 10.712891 10.292969 c
+10.712891 10.957031 10.585938 11.533203 10.332031 12.021484 c
+10.078125 12.516276 9.707031 12.926433 9.218750 13.251953 c
+8.736979 13.577474 8.151042 13.818359 7.460938 13.974609 c
+6.770833 14.137370 5.986328 14.218750 5.107422 14.218750 c
+0.000000 14.218750 l
+0.000000 0.000000 l
+5.664062 0.000000 l
+6.835938 0.000000 7.819010 0.156250 8.613281 0.468750 c
+9.407552 0.781250 10.003255 1.250000 10.400391 1.875000 c
+10.804036 2.500000 11.005859 3.277995 11.005859 4.208984 c
+11.005859 4.755859 10.885417 5.279948 10.644531 5.781250 c
+10.403646 6.282552 10.003255 6.686198 9.443359 6.992188 c
+9.239742 7.104776 9.009242 7.194005 8.751858 7.259878 c
+h
+3.427734 6.044922 m
+3.427734 2.636719 l
+5.664062 2.636719 l
+6.132812 2.636719 6.507162 2.708333 6.787109 2.851562 c
+7.073568 3.001302 7.278646 3.196614 7.402344 3.437500 c
+7.532552 3.684896 7.597656 3.958333 7.597656 4.257812 c
+7.597656 4.622396 7.535807 4.938151 7.412109 5.205078 c
+7.294922 5.472005 7.106120 5.677083 6.845703 5.820312 c
+6.585287 5.970052 6.236979 6.044922 5.800781 6.044922 c
+3.427734 6.044922 l
+h
+5.087891 8.291016 m
+5.621745 8.291016 6.048177 8.349609 6.367188 8.466797 c
+6.686198 8.590494 6.917318 8.769531 7.060547 9.003906 c
+7.210287 9.238281 7.285156 9.531250 7.285156 9.882812 c
+7.285156 10.286458 7.210287 10.611979 7.060547 10.859375 c
+6.910807 11.106771 6.673177 11.285808 6.347656 11.396484 c
+6.028646 11.513672 5.615234 11.572266 5.107422 11.572266 c
+3.427734 11.572266 l
+3.427734 8.291016 l
+5.087891 8.291016 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  2027
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 40.000000 32.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000074 00000 n
+0000002157 00000 n
+0000002180 00000 n
+0000002353 00000 n
+0000002427 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+2486
+%%EOF

+ 0 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageCenter.imageset/AligmentCenter.svg

@@ -1 +0,0 @@
-<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1682584920188" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5240" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M96 128h832v96H96zM96 576h832v96H96zM224 352h576v96H224zM224 800h576v96H224z" p-id="5241"></path></svg>

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageCenter.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "AligmentCenter.svg",
+      "filename" : "Segmented Item.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },

+ 83 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageCenter.imageset/Segmented Item.pdf

@@ -0,0 +1,83 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 16.000000 11.000000 cm
+0.000000 0.000000 0.000000 scn
+16.000000 8.000000 m
+16.000000 9.000000 l
+0.000000 9.000000 l
+0.000000 8.000000 l
+16.000000 8.000000 l
+h
+16.000000 0.000000 m
+16.000000 1.000000 l
+0.000000 1.000000 l
+0.000000 0.000000 l
+16.000000 0.000000 l
+h
+13.000000 5.000000 m
+13.000000 4.000000 l
+3.000000 4.000000 l
+3.000000 5.000000 l
+13.000000 5.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  443
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 48.666504 30.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000533 00000 n
+0000000555 00000 n
+0000000728 00000 n
+0000000802 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+861
+%%EOF

+ 0 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageLeft.imageset/AlignmentLeft.svg

@@ -1 +0,0 @@
-<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1682584933370" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6254" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M96 128h832v96H96zM96 576h832v96H96zM96 352h576v96H96zM96 800h576v96H96z" p-id="6255"></path></svg>

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageLeft.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "AlignmentLeft.svg",
+      "filename" : "Segmented Item.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },

+ 96 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageLeft.imageset/Segmented Item.pdf

@@ -0,0 +1,96 @@
+%PDF-1.7
+
+1 0 obj
+  << /ExtGState << /E1 << /ca 0.160000 >> >> >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+/E1 gs
+1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
+0.286275 0.509804 0.901961 scn
+0.000000 30.000000 m
+48.666668 30.000000 l
+48.666668 0.000000 l
+0.000000 0.000000 l
+0.000000 30.000000 l
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 16.000000 11.000000 cm
+0.000000 0.000000 0.000000 scn
+13.000000 8.000000 m
+13.000000 9.000000 l
+0.000000 9.000000 l
+0.000000 8.000000 l
+13.000000 8.000000 l
+h
+16.000000 4.000000 m
+16.000000 5.000000 l
+0.000000 5.000000 l
+0.000000 4.000000 l
+16.000000 4.000000 l
+h
+10.000000 1.000000 m
+10.000000 0.000000 l
+0.000000 0.000000 l
+0.000000 1.000000 l
+10.000000 1.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  654
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 48.666504 30.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000074 00000 n
+0000000784 00000 n
+0000000806 00000 n
+0000000979 00000 n
+0000001053 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1112
+%%EOF

+ 0 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageRight.imageset/AlignmentRight.svg

@@ -1 +0,0 @@
-<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1682584902978" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4215" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M96 128h832v96H96zM96 576h832v96H96zM352 352h576v96H352zM352 800h576v96H352z" p-id="4216"></path></svg>

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageRight.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "AlignmentRight.svg",
+      "filename" : "Segmented Item.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },

+ 95 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageRight.imageset/Segmented Item.pdf

@@ -0,0 +1,95 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 16.000977 11.000000 cm
+0.000000 0.000000 0.000000 scn
+15.999023 8.000000 m
+15.999023 9.000000 l
+2.999817 9.000000 l
+2.999817 8.000000 l
+15.999023 8.000000 l
+h
+15.999023 4.000000 m
+15.999023 5.000000 l
+0.000000 5.000000 l
+0.000000 4.000000 l
+15.999023 4.000000 l
+h
+15.999023 1.000000 m
+15.999023 0.000000 l
+5.999634 0.000000 l
+5.999634 1.000000 l
+15.999023 1.000000 l
+h
+f*
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 0.000000 7.000000 cm
+0.886275 0.890196 0.901961 scn
+0.000000 16.000000 m
+1.000000 16.000000 l
+1.000000 0.000000 l
+0.000000 0.000000 l
+0.000000 16.000000 l
+h
+f
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  645
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 48.666504 30.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000735 00000 n
+0000000757 00000 n
+0000000930 00000 n
+0000001004 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1063
+%%EOF

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageUnderline.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "ItalicNormal.svg",
+      "filename" : "Item.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },

Разница между файлами не показана из-за своего большого размера
+ 0 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageUnderline.imageset/ItalicNormal.svg


+ 79 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFFreeText/Image.xcassets/CPDFFreeTextImageUnderline.imageset/Item.pdf

@@ -0,0 +1,79 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 14.500000 9.000000 cm
+0.258000 0.273273 0.300000 scn
+11.000000 11.000000 m
+8.333333 11.000000 l
+5.666667 3.000000 l
+8.000000 3.000000 l
+8.000000 0.000000 l
+0.000000 0.000000 l
+0.000000 3.000000 l
+2.666667 3.000000 l
+5.333333 11.000000 l
+3.000000 11.000000 l
+3.000000 14.000000 l
+11.000000 14.000000 l
+11.000000 11.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  399
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 40.000000 32.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000489 00000 n
+0000000511 00000 n
+0000000684 00000 n
+0000000758 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+817
+%%EOF

+ 21 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkTopToolBar.h

@@ -14,8 +14,29 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+typedef NS_ENUM(NSInteger, CPDFInkTopToolBarSelect) {
+    CPDFInkTopToolBarSetting = 0,
+    CPDFInkTopToolBarErase,
+    CPDFInkTopToolBarUndo,
+    CPDFInkTopToolBarRedo,
+    CPDFInkTopToolBarClear,
+    CPDFInkTopToolBarSave
+};
+
+@class CPDFInkTopToolBar;
+
+@protocol CPDFInkTopToolBarDelegate <NSObject>
+
+@optional
+
+- (void)inkTopToolBar:(CPDFInkTopToolBar *)inkTopToolBar tag:(NSInteger)tag isSelect:(BOOL)isSelect;
+
+@end
+
 @interface CPDFInkTopToolBar : UIView
 
+@property (nonatomic, weak) id<CPDFInkTopToolBarDelegate> delegate;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 70 - 13
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkTopToolBar.m

@@ -27,33 +27,40 @@
         self.layer.borderWidth = 1.0;
         self.layer.cornerRadius = 5.0;
         
-        CGFloat width = self.bounds.size.width/5;
+        CGFloat width = self.bounds.size.width/6;
         CGFloat height = self.bounds.size.height;
         
+        UIButton *settingButton = [UIButton buttonWithType:UIButtonTypeCustom];
+        settingButton.tag = 0;
+        settingButton.frame = CGRectMake(0, 0, width, height);
+        [settingButton setImage:[UIImage imageNamed:@"CPDFInkImageSetting" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
+        [settingButton addTarget:self action:@selector(buttonItemClicked_Switch:) forControlEvents:UIControlEventTouchUpInside];
+        [self addSubview:settingButton];
+        
         UIButton *undoButton = [[UIButton alloc] init];
-        undoButton.tag = 0;
-        undoButton.frame = CGRectMake(width, 0, width, height);
+        undoButton.tag = 2;
+        undoButton.frame = CGRectMake(width*2, 0, width, height);
         [undoButton setImage:[UIImage imageNamed:@"CPDFInkImageUndo" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [undoButton addTarget:self action:@selector(buttonItemClicked_Switch:) forControlEvents:UIControlEventTouchUpInside];
         [self addSubview:undoButton];
         
         UIButton *redoButton = [UIButton buttonWithType:UIButtonTypeCustom];
-        redoButton.tag = 1;
-        redoButton.frame = CGRectMake(width*2, 0, width, height);
+        redoButton.tag = 3;
+        redoButton.frame = CGRectMake(width*3, 0, width, height);
         [redoButton setImage:[UIImage imageNamed:@"CPDFInkImageRedo" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [redoButton addTarget:self action:@selector(buttonItemClicked_Switch:) forControlEvents:UIControlEventTouchUpInside];
         [self addSubview:redoButton];
         
         UIButton *eraseButton = [UIButton buttonWithType:UIButtonTypeCustom];
-        eraseButton.tag = 2;
-        eraseButton.frame = CGRectMake(0, 0, width, height);
+        eraseButton.tag = 1;
+        eraseButton.frame = CGRectMake(width, 0, width, height);
         [eraseButton setImage:[UIImage imageNamed:@"CPDFInkImageEraer" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         [eraseButton addTarget:self action:@selector(buttonItemClicked_Switch:) forControlEvents:UIControlEventTouchUpInside];
         [self addSubview:eraseButton];
         
         UIButton *clearButton = [UIButton buttonWithType:UIButtonTypeSystem];
-        clearButton.tag = 3;
-        clearButton.frame = CGRectMake(3*width, 0, width, height);
+        clearButton.tag = 4;
+        clearButton.frame = CGRectMake(4*width, 0, width, height);
         [clearButton setTitle:NSLocalizedString(@"Clear", nil) forState:UIControlStateNormal];
         [clearButton setTitleColor:[UIColor colorWithRed:243.0/255.0 green:0 blue:8.0/255.0 alpha:1.0] forState:UIControlStateNormal];
         clearButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
@@ -61,8 +68,8 @@
         [self addSubview:clearButton];
         
         UIButton *saveButton = [UIButton buttonWithType:UIButtonTypeSystem];
-        saveButton.tag = 3;
-        saveButton.frame = CGRectMake(4*width, 0, width, height);
+        saveButton.tag = 5;
+        saveButton.frame = CGRectMake(5*width, 0, width, height);
         [saveButton setTitle:NSLocalizedString(@"Save", nil) forState:UIControlStateNormal];
         [saveButton setTitleColor:[UIColor colorWithRed:41.0/255.0 green:111.0/255.0 blue:173.0/255.0 alpha:1.0] forState:UIControlStateNormal];
         saveButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
@@ -75,8 +82,58 @@
 #pragma mark - Action
 
 - (void)buttonItemClicked_Switch:(UIButton *)button {
-    if (button.tag == 3) {
-        [self removeFromSuperview];
+    switch (button.tag) {
+        case CPDFInkTopToolBarSetting:
+        {
+            if (self.delegate && [self.delegate respondsToSelector:@selector(inkTopToolBar:tag:isSelect:)]) {
+                [self.delegate inkTopToolBar:self tag:button.tag isSelect:button.isSelected];
+            }
+        }
+            break;
+        case CPDFInkTopToolBarErase:
+        {
+            button.selected = !button.isSelected;
+            if (button.isSelected) {
+                button.backgroundColor = [UIColor lightGrayColor];
+            } else {
+                button.backgroundColor = [UIColor clearColor];
+            }
+            if (self.delegate && [self.delegate respondsToSelector:@selector(inkTopToolBar:tag:isSelect:)]) {
+                [self.delegate inkTopToolBar:self tag:button.tag isSelect:button.isSelected];
+            }
+        }
+            break;
+        case CPDFInkTopToolBarUndo:
+        {
+            if (self.delegate && [self.delegate respondsToSelector:@selector(inkTopToolBar:tag:isSelect:)]) {
+                [self.delegate inkTopToolBar:self tag:button.tag isSelect:button.isSelected];
+            }
+        }
+            break;
+        case CPDFInkTopToolBarRedo:
+        {
+            if (self.delegate && [self.delegate respondsToSelector:@selector(inkTopToolBar:tag:isSelect:)]) {
+                [self.delegate inkTopToolBar:self tag:button.tag isSelect:button.isSelected];
+            }
+        }
+            break;
+        case CPDFInkTopToolBarClear:
+        {
+            if (self.delegate && [self.delegate respondsToSelector:@selector(inkTopToolBar:tag:isSelect:)]) {
+                [self.delegate inkTopToolBar:self tag:button.tag isSelect:button.isSelected];
+            }
+            [self removeFromSuperview];
+        }
+            break;
+            
+        case CPDFInkTopToolBarSave:
+        {
+            if (self.delegate && [self.delegate respondsToSelector:@selector(inkTopToolBar:tag:isSelect:)]) {
+                [self.delegate inkTopToolBar:self tag:button.tag isSelect:button.isSelected];
+            }
+            [self removeFromSuperview];
+        }
+            break;
     }
 }
 

+ 13 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkViewController.h

@@ -14,8 +14,21 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class CPDFInkViewController;
+@class CAnnotStyle;
+
+@protocol CPDFInkViewControllerDelegate <NSObject>
+
+@optional
+
+- (void)inkViewController:(CPDFInkViewController *)inkViewController annotStyle:(CAnnotStyle *)annotStyle;
+
+@end
+
 @interface CPDFInkViewController : CPDFAnnotationBaseViewController
 
+@property (nonatomic, weak) id<CPDFInkViewControllerDelegate> delegate;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 55 - 3
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/CPDFInkViewController.m

@@ -32,12 +32,18 @@
     _thicknessView.delegate = self;
     _thicknessView.thicknessSlider.value = 4.0;
     _thicknessView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [self.view addSubview:self.thicknessView];
+    [self.scrcollView addSubview:self.thicknessView];
 }
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
-    self.thicknessView.frame = CGRectMake(10, 370, self.view.frame.size.width - 20, 90);
+    self.scrcollView.frame = CGRectMake(0, 50, self.view.frame.size.width, 430);
+    self.scrcollView.contentSize = CGSizeMake(self.view.frame.size.width, 520);
+    if (@available(iOS 11.0, *)) {
+        self.thicknessView.frame = CGRectMake(self.view.safeAreaInsets.left, 300, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+    } else {
+        self.thicknessView.frame = CGRectMake(10, 300, self.view.frame.size.width - 20, 90);
+    }
 }
 
 - (void)commomInitTitle {
@@ -47,14 +53,60 @@
     self.sampleView.thickness = 4.0;
 }
 
+- (void)commomInitFromAnnotStyle {
+    self.sampleView.fillColor = self.annotStyle.color;
+    self.sampleView.opcity = self.annotStyle.opacity;
+    self.sampleView.thickness = self.annotStyle.lineWidth;
+    self.opacitySliderView.opacitySlider.value = self.annotStyle.opacity;
+    self.thicknessView.thicknessSlider.value = self.annotStyle.lineWidth;
+    [self.sampleView setNeedsDisplay];
+}
+
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 270 : 520);
+    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 520);
 }
 
 #pragma mark - CPDFThicknessSliderViewDelegate
 
 - (void)thicknessSliderView:(CPDFThicknessSliderView *)thicknessSliderView thickness:(CGFloat)thickness {
     self.sampleView.thickness = thickness;
+    self.annotStyle.lineWidth = thickness;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(inkViewController:annotStyle:)]) {
+        [self.delegate inkViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
+}
+
+#pragma mark - CPDFColorSelectViewDelegate
+
+- (void)selectColorView:(CPDFColorSelectView *)select color:(UIColor *)color {
+    self.sampleView.fillColor = color;
+    self.annotStyle.color = color;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(inkViewController:annotStyle:)]) {
+        [self.delegate inkViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
+}
+
+#pragma mark - CPDFColorPickerViewDelegate
+
+- (void)pickerView:(CPDFColorPickerView *)colorPickerView color:(UIColor *)color {
+    self.sampleView.fillColor = color;
+    self.annotStyle.color = color;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(inkViewController:annotStyle:)]) {
+        [self.delegate inkViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
+}
+
+#pragma mark - CPDFOpacitySliderViewDelegate
+
+- (void)opacitySliderView:(CPDFOpacitySliderView *)opacitySliderView opacity:(CGFloat)opacity {
+    self.sampleView.opcity = opacity;
+    self.annotStyle.opacity = opacity;
+    if (self.delegate && [self.delegate respondsToSelector:@selector(inkViewController:annotStyle:)]) {
+        [self.delegate inkViewController:self annotStyle:self.annotStyle];
+    }
     [self.sampleView setNeedsDisplay];
 }
 

+ 1 - 2
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/Contents.json

@@ -1,12 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "btn_eraser_00.png",
+      "filename" : "eraser.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
-      "filename" : "btn_eraser_00@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

BIN
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/btn_eraser_00.png


BIN
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/btn_eraser_00@2x.png


+ 109 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageEraer.imageset/eraser.pdf

@@ -0,0 +1,109 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
+0.262745 0.278431 0.301961 scn
+1.238950 3.901874 m
+0.549718 4.579425 0.549717 5.677955 1.238950 6.355508 c
+9.011107 13.995950 l
+9.545950 14.521729 l
+10.080793 13.995950 l
+15.030540 9.130086 l
+15.565383 8.604307 l
+15.030540 8.078529 l
+10.787900 3.907788 l
+7.959473 1.127295 l
+7.737934 0.909511 l
+7.424631 0.909510 l
+4.596203 0.909511 l
+4.282899 0.909511 l
+4.061360 1.127295 l
+1.238950 3.901874 l
+h
+2.308635 5.303950 m
+2.210174 5.207157 2.210174 5.050224 2.308636 4.953431 c
+4.909506 2.396637 l
+7.111326 2.396637 l
+7.769131 3.043294 l
+3.889069 6.857600 l
+2.308635 5.303950 l
+h
+9.718214 4.959346 m
+8.838816 4.094851 l
+4.958754 7.909157 l
+9.545950 12.418613 l
+13.426012 8.604307 l
+9.718214 4.959346 l
+h
+0.000000 1.500103 m
+1.191050 1.500103 l
+2.716909 0.000103 l
+0.000000 0.000103 l
+0.000000 1.500103 l
+h
+15.500000 0.000103 m
+8.237010 0.000103 l
+9.762869 1.500103 l
+15.500000 1.500103 l
+15.500000 0.000103 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  1001
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 15.565430 14.521729 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000001091 00000 n
+0000001114 00000 n
+0000001287 00000 n
+0000001361 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1420
+%%EOF

+ 1 - 2
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/Contents.json

@@ -1,12 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "btn_redo.png",
+      "filename" : "redo.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
-      "filename" : "btn_redo@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

BIN
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/btn_redo.png


BIN
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/btn_redo@2x.png


+ 84 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageRedo.imageset/redo.pdf

@@ -0,0 +1,84 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+-1.000000 -0.000000 -0.000000 1.000000 16.810547 4.098389 cm
+0.262745 0.278431 0.301961 scn
+0.530330 8.280304 m
+0.000000 7.749974 l
+0.530330 7.219644 l
+4.151638 3.598336 l
+5.212297 4.658997 l
+2.871320 6.999974 l
+9.560660 6.999974 l
+11.079443 6.999974 12.310660 5.768757 12.310660 4.249974 c
+12.310660 2.731191 11.079443 1.499973 9.560660 1.499973 c
+2.060660 1.499973 l
+2.060660 -0.000027 l
+9.560660 -0.000027 l
+11.907870 -0.000027 13.810660 1.902763 13.810660 4.249974 c
+13.810660 6.597184 11.907870 8.499973 9.560660 8.499973 c
+2.871320 8.499973 l
+5.212297 10.840951 l
+4.151638 11.901611 l
+0.530330 8.280304 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  650
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000740 00000 n
+0000000762 00000 n
+0000000935 00000 n
+0000001009 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1068
+%%EOF

+ 1 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInk.imageset/Contents.json

@@ -1,6 +1,7 @@
 {
   "images" : [
     {
+      "filename" : "Union.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },

+ 101 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageSetting.imageset/Union.pdf

@@ -0,0 +1,101 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
+0.262745 0.278431 0.301961 scn
+5.854621 12.749998 m
+14.000000 12.749999 l
+14.000000 11.249999 l
+5.854620 11.249998 l
+5.557926 10.517042 4.839344 10.000000 4.000000 10.000000 c
+3.160656 10.000000 2.442074 10.517042 2.145380 11.249998 c
+0.000000 11.249998 l
+0.000000 12.749998 l
+2.145379 12.749998 l
+2.442072 13.482957 3.160655 14.000000 4.000000 14.000000 c
+4.839345 14.000000 5.557928 13.482957 5.854621 12.749998 c
+h
+0.000000 6.249999 m
+8.145379 6.250000 l
+8.442073 5.517042 9.160656 5.000000 10.000000 5.000000 c
+10.839344 5.000000 11.557927 5.517042 11.854621 6.250000 c
+14.000000 6.250000 l
+14.000000 7.750000 l
+11.854621 7.750000 l
+11.557927 8.482958 10.839344 9.000000 10.000000 9.000000 c
+9.160656 9.000000 8.442073 8.482958 8.145379 7.750000 c
+0.000000 7.749999 l
+0.000000 6.249999 l
+h
+2.145379 1.250000 m
+0.000000 1.250000 l
+0.000000 2.750000 l
+2.145379 2.750000 l
+2.442073 3.482958 3.160656 4.000000 4.000000 4.000000 c
+4.839344 4.000000 5.557927 3.482957 5.854620 2.750000 c
+14.000000 2.750001 l
+14.000000 1.250001 l
+5.854621 1.250000 l
+5.557927 0.517042 4.839345 0.000000 4.000000 0.000000 c
+3.160655 0.000000 2.442073 0.517042 2.145379 1.250000 c
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  1257
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 14.000000 14.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000001347 00000 n
+0000001370 00000 n
+0000001543 00000 n
+0000001617 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1676
+%%EOF

+ 1 - 2
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/Contents.json

@@ -1,12 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "btn_undo.png",
+      "filename" : "undo.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
-      "filename" : "btn_undo@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

BIN
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/btn_undo.png


BIN
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/btn_undo@2x.png


+ 84 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFInk/Image.xcassets/CPDFInkImageUndo.imageset/undo.pdf

@@ -0,0 +1,84 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 3.000000 4.098389 cm
+0.262745 0.278431 0.301961 scn
+0.530330 8.280304 m
+0.000000 7.749974 l
+0.530330 7.219644 l
+4.151638 3.598336 l
+5.212297 4.658997 l
+2.871320 6.999974 l
+9.560660 6.999974 l
+11.079443 6.999974 12.310660 5.768757 12.310660 4.249974 c
+12.310660 2.731191 11.079443 1.499973 9.560660 1.499973 c
+2.060660 1.499973 l
+2.060660 -0.000027 l
+9.560660 -0.000027 l
+11.907870 -0.000027 13.810660 1.902763 13.810660 4.249974 c
+13.810660 6.597184 11.907870 8.499973 9.560660 8.499973 c
+2.871320 8.499973 l
+5.212297 10.840951 l
+4.151638 11.901611 l
+0.530330 8.280304 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  647
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000737 00000 n
+0000000759 00000 n
+0000000932 00000 n
+0000001006 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1065
+%%EOF

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFNote/CPDFNoteViewController.m

@@ -110,7 +110,7 @@
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection
 {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 200 : 320);
+    self.preferredContentSize = CGSizeMake(MIN(self.view.bounds.size.width, self.view.bounds.size.height), traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 320 : 320);
 }
 
 #pragma mark - Action

+ 13 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.h

@@ -14,8 +14,21 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class CPDFShapeArrowViewController;
+@class CAnnotStyle;
+
+@protocol CPDFShapeArrowViewControllerDelegate <NSObject>
+
+@optional
+
+- (void)arrowViewController:(CPDFShapeArrowViewController *)arrowViewController annotStyle:(CAnnotStyle *)annotStyle;
+
+@end
+
 @interface CPDFShapeArrowViewController : CPDFShapeCircleViewController
 
+@property (nonatomic, weak) id<CPDFShapeArrowViewControllerDelegate> lineDelegate;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 134 - 31
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeArrowViewController.m

@@ -24,6 +24,12 @@
 
 @property (nonatomic, strong) UIButton *trialBtn;
 
+@property (nonatomic, strong) CPDFArrowStyleView *startArrowStyleView;
+
+@property (nonatomic ,strong) CPDFArrowStyleView *endArrowStyleView;
+
+@property (nonatomic, strong) NSMutableArray *dashPattern;
+
 @end
 
 @implementation CPDFShapeArrowViewController
@@ -34,72 +40,169 @@
     [super viewDidLoad];
     // Do any additional setup after loading the view.
     self.arrowLabel = [[UILabel alloc] init];
-    self.arrowLabel.text = @"Start";
-    [self.view addSubview:self.arrowLabel];
+    self.arrowLabel.text = @"Arrow Style";
+    self.arrowLabel.textColor = [UIColor grayColor];
+    self.arrowLabel.font = [UIFont systemFontOfSize:12.0];
+    [self.scrcollView addSubview:self.arrowLabel];
     
     self.arrowBtn = [[UIButton alloc] init];
     [self.arrowBtn setImage:[UIImage imageNamed:@"CPDFShapeArrowImageStart" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     self.arrowBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
     [self.arrowBtn addTarget:self action:@selector(buttonItemClicked_start:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.arrowBtn];
+    [self.scrcollView addSubview:self.arrowBtn];
     
     self.trialLabel = [[UILabel alloc] init];
-    self.trialLabel.text = @"End";
+    self.trialLabel.text = @"Arrowtail style";
+    self.trialLabel.textColor = [UIColor grayColor];
+    self.trialLabel.font = [UIFont systemFontOfSize:12.0];
     self.trialLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
-    [self.view addSubview:self.trialLabel];
+    [self.scrcollView addSubview:self.trialLabel];
     
     self.trialBtn = [[UIButton alloc] init];
     [self.trialBtn setImage:[UIImage imageNamed:@"CPDFShapeArrowImageEnd" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.trialBtn addTarget:self action:@selector(buttonItemClicked_trial:) forControlEvents:UIControlEventTouchUpInside];
     self.trialBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
-    [self.view addSubview:self.trialBtn];
+    [self.scrcollView addSubview:self.trialBtn];
     
-    if (self.index == CPDFToolbarShapeLine) {
-        self.sampleView.arrowStyleIndex = 0;
-    } else if (self.index == CPDFToolbarShapeArrow) {
-        self.sampleView.arrowStyleIndex = 1;
-    }
     [self.fillColorSelectView removeFromSuperview];
 }
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
-    self.opacitySliderView.frame = CGRectMake(10, 280, self.view.frame.size.width - 20, 90);
-    self.thicknessView.frame = CGRectMake(10, 370, self.view.frame.size.width - 20, 90);
-    self.dottedView.frame = CGRectMake(10, 460, self.view.frame.size.width - 20, 90);
-    self.arrowLabel.frame = CGRectMake(15, 550, 60, 45);
-    self.arrowBtn.frame = CGRectMake(self.view.frame.size.width - 75, 550, 60, 45);
-    self.trialLabel.frame = CGRectMake(15, 595, 60, 45);
-    self.trialBtn.frame = CGRectMake(self.view.frame.size.width - 75, 595, 60, 45);
+    self.scrcollView.frame = CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height-50);
+    self.scrcollView.contentSize = CGSizeMake(self.view.frame.size.width, 670);
+    
+    if (@available(iOS 11.0, *)) {
+        self.opacitySliderView.frame = CGRectMake(self.view.safeAreaInsets.left, 210, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.thicknessView.frame = CGRectMake(self.view.safeAreaInsets.left, 300, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.dottedView.frame = CGRectMake(self.view.safeAreaInsets.left, 390, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.arrowLabel.frame = CGRectMake(self.view.safeAreaInsets.left+15, 480, 80, 45);
+        self.arrowBtn.frame = CGRectMake(self.view.frame.size.width - 75- self.view.safeAreaInsets.right, 480, 60, 45);
+        self.trialLabel.frame = CGRectMake(self.view.safeAreaInsets.left+15, 525, 100, 45);
+        self.trialBtn.frame = CGRectMake(self.view.frame.size.width - 75- self.view.safeAreaInsets.right, 525, 60, 45);
+    } else {
+        self.opacitySliderView.frame = CGRectMake(10, 210, self.view.frame.size.width - 20, 90);
+        self.thicknessView.frame = CGRectMake(10, 300, self.view.frame.size.width - 20, 90);
+        self.dottedView.frame = CGRectMake(10, 390, self.view.frame.size.width - 20, 90);
+        self.arrowLabel.frame = CGRectMake(15, 480, 60, 45);
+        self.arrowBtn.frame = CGRectMake(self.view.frame.size.width - 75, 480, 60, 45);
+        self.trialLabel.frame = CGRectMake(15, 525, 60, 45);
+        self.trialBtn.frame = CGRectMake(self.view.frame.size.width - 75, 525, 60, 45);
+    }
+}
+
+#pragma mark - Protect Mehthods
+
+- (void)commomInitFromAnnotStyle {
+    self.sampleView.fillColor = self.annotStyle.color;
+    self.sampleView.opcity = self.annotStyle.opacity;
+    self.opacitySliderView.opacitySlider.value = self.annotStyle.opacity;
+    self.thicknessView.thicknessSlider.value = self.annotStyle.lineWidth;
+    self.sampleView.thickness = self.annotStyle.lineWidth;
+    self.dashPattern = (NSMutableArray *)self.annotStyle.dashPattern;
+    self.dottedView.thicknessSlider.value = [self.dashPattern.firstObject floatValue];
+    self.sampleView.dotted = self.dottedView.thicknessSlider.value;
+    self.sampleView.fillShapeColor = self.annotStyle.interiorColor;
+    self.sampleView.startArrowStyleIndex = (NSInteger)self.annotStyle.startLineStyle;
+    self.sampleView.endArrowStyleIndex = (NSInteger)self.annotStyle.endLineStyle;
+    [self.sampleView setNeedsDisplay];
 }
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 370 : 660);
+    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 660);
 }
 
 #pragma mark - Action
 
 - (void)buttonItemClicked_start:(id)sender {
-    CPDFArrowStyleView *arrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:@"Arrow Style"];
-    arrowStyleView.frame = self.view.frame;
-    arrowStyleView.delegate = self;
-    arrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-    [self.view addSubview:arrowStyleView];
+    self.startArrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:@"Arrow Style"];
+    self.startArrowStyleView.frame = self.view.frame;
+    self.startArrowStyleView.delegate = self;
+    self.startArrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    [self.view addSubview:self.startArrowStyleView];
 }
 
 - (void)buttonItemClicked_trial:(id)sender {
-    CPDFArrowStyleView *arrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:@"Trial Style"];
-    arrowStyleView.frame = self.view.frame;
-    arrowStyleView.delegate = self;
-    arrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-    [self.view addSubview:arrowStyleView];
+    self.endArrowStyleView = [[CPDFArrowStyleView alloc] initWirhTitle:@"Arrowtail style"];
+    self.endArrowStyleView.frame = self.view.frame;
+    self.endArrowStyleView.delegate = self;
+    self.endArrowStyleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    [self.view addSubview:self.endArrowStyleView];
+}
+
+#pragma mark - CPDFOpacitySliderViewDelegate
+
+- (void)opacitySliderView:(CPDFOpacitySliderView *)opacitySliderView opacity:(CGFloat)opacity {
+    self.sampleView.opcity = opacity;
+    self.annotStyle.opacity = opacity;
+    if (self.lineDelegate && [self.lineDelegate respondsToSelector:@selector(arrowViewController:annotStyle:)]) {
+        [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
+}
+
+#pragma mark - CPDFThicknessSliderViewDelegate
+
+- (void)thicknessSliderView:(CPDFThicknessSliderView *)thicknessSliderView thickness:(CGFloat)thickness {
+    if (thicknessSliderView == self.thicknessView) {
+        self.sampleView.thickness = thickness;
+        self.annotStyle.lineWidth = thickness;
+        [self.sampleView setNeedsDisplay];
+        if (self.lineDelegate && [self.lineDelegate respondsToSelector:@selector(arrowViewController:annotStyle:)]) {
+            [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
+        }
+    } else if (thicknessSliderView == self.dottedView) {
+        self.sampleView.dotted = thickness;
+        self.annotStyle.style = CPDFBorderStyleDashed;
+        self.annotStyle.dashPattern = @[@10, [NSNumber numberWithFloat:(float)thickness]];
+        if (self.lineDelegate && [self.lineDelegate respondsToSelector:@selector(arrowViewController:annotStyle:)]) {
+            [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
+        }
+        [self.sampleView setNeedsDisplay];
+    }
+}
+
+#pragma mark - CPDFColorSelectViewDelegate
+
+- (void)selectColorView:(CPDFColorSelectView *)select color:(UIColor *)color {
+    self.sampleView.fillColor = color;
+    self.annotStyle.color = color;
+    if (self.lineDelegate && [self.lineDelegate respondsToSelector:@selector(arrowViewController:annotStyle:)]) {
+        [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
 }
 
+#pragma mark - CPDFColorPickerViewDelegate
+
+- (void)pickerView:(CPDFColorPickerView *)colorPickerView color:(UIColor *)color {
+    self.sampleView.fillColor = color;
+    self.annotStyle.color = color;
+    if (self.lineDelegate && [self.lineDelegate respondsToSelector:@selector(arrowViewController:annotStyle:)]) {
+        [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
+    }
+    [self.sampleView setNeedsDisplay];
+}
+
+
 #pragma mark - CPDFArrowStyleViewDelegate
 
 - (void)arrowStyleView:(CPDFArrowStyleView *)arrowStyleView selectIndex:(NSInteger)selectIndex {
-    self.sampleView.arrowStyleIndex = selectIndex;
-    [self.sampleView setNeedsDisplay];
+    if (arrowStyleView == self.startArrowStyleView) {
+        self.sampleView.startArrowStyleIndex = selectIndex;
+        self.annotStyle.startLineStyle = selectIndex;
+        if (self.lineDelegate && [self.lineDelegate respondsToSelector:@selector(arrowViewController:annotStyle:)]) {
+            [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
+        }
+        [self.sampleView setNeedsDisplay];
+    } else if (arrowStyleView == self.endArrowStyleView) {
+        self.sampleView.endArrowStyleIndex = selectIndex;
+        [self.sampleView setNeedsDisplay];
+        self.annotStyle.endLineStyle = selectIndex;
+        if (self.lineDelegate && [self.lineDelegate respondsToSelector:@selector(arrowViewController:annotStyle:)]) {
+            [self.lineDelegate arrowViewController:self annotStyle:self.annotStyle];
+        }
+    }
 }
 
 @end

+ 1 - 2
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeCircleViewController.h

@@ -15,6 +15,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @class CPDFShapeCircleViewController;
+@class CAnnotStyle;
 
 @protocol CPDFShapeCircleViewControllerDelegate <NSObject>
 
@@ -26,8 +27,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFShapeCircleViewController : CPDFAnnotationBaseViewController
 
-- (instancetype)initWithStyle:(CAnnotStyle *)annotStyle selectIndex:(NSInteger)index title:(NSString *)title;
-
 @property (nonatomic, weak) id<CPDFShapeCircleViewControllerDelegate> delegate;
 
 @end

+ 47 - 22
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeCircleViewController.m

@@ -40,42 +40,42 @@
     _thicknessView = [[CPDFThicknessSliderView alloc] init];
     _thicknessView.delegate = self;
     _thicknessView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [self.view addSubview:self.thicknessView];
+    [self.scrcollView addSubview:self.thicknessView];
     
     self.dottedView = [[CPDFThicknessSliderView alloc] init];
     self.dottedView.delegate = self;
     self.dottedView.thicknessSlider.minimumValue = 0.0;
     self.dottedView.thicknessSlider.maximumValue = 10.0;
     self.dottedView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [self.view addSubview:self.dottedView];
+    [self.scrcollView addSubview:self.dottedView];
     
     self.fillColorSelectView = [[CPDFColorSelectView alloc] init];
     self.fillColorSelectView.delegate = self;
     self.fillColorSelectView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [self.view addSubview:self.fillColorSelectView];
+    [self.scrcollView addSubview:self.fillColorSelectView];
 }
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
-    self.titleLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, 5, 120, ((self.view.frame.size.height)/15));
-    self.sampleView.frame  = CGRectMake((self.view.frame.size.width - 300)/2, ((self.view.frame.size.height)/15), 300, ((self.view.frame.size.height)/15)*3);
+    self.scrcollView.frame = CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height-50);
+    self.scrcollView.contentSize = CGSizeMake(self.view.frame.size.width, 670);
     
     if (@available(iOS 11.0, *)) {
         self.colorPicker.frame = CGRectMake(self.view.safeAreaInsets.left, 0, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height);
-        self.colorView.frame = CGRectMake(self.view.safeAreaInsets.left, ((self.view.frame.size.height)/15)*4,self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, ((self.view.frame.size.height)/15)*2);
-        self.fillColorSelectView.frame = CGRectMake(self.view.safeAreaInsets.left, ((self.view.frame.size.height)/15)*6, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, ((self.view.frame.size.height)/15)*2);
-        self.opacitySliderView.frame = CGRectMake(self.view.safeAreaInsets.left, ((self.view.frame.size.height)/15)*8, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, ((self.view.frame.size.height)/15)*2);
-        self.thicknessView.frame = CGRectMake(self.view.safeAreaInsets.left, ((self.view.frame.size.height)/15)*10, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, ((self.view.frame.size.height)/15)*2);
-        self.dottedView.frame = CGRectMake(self.view.safeAreaInsets.left, ((self.view.frame.size.height)/15)*12, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, ((self.view.frame.size.height)/15)*2);
-        self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, ((self.view.frame.size.height)/15));
+        self.colorView.frame = CGRectMake(self.view.safeAreaInsets.left, 120,self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.fillColorSelectView.frame = CGRectMake(self.view.safeAreaInsets.left, 210, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.opacitySliderView.frame = CGRectMake(self.view.safeAreaInsets.left, 300, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.thicknessView.frame = CGRectMake(self.view.safeAreaInsets.left, 390, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.dottedView.frame = CGRectMake(self.view.safeAreaInsets.left, 470, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, 90);
+        self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60 - self.view.safeAreaInsets.right, 5, 50, 50);
     } else {
         self.colorPicker.frame = self.view.frame;
-        self.colorView.frame = CGRectMake(0, ((self.view.frame.size.height)/15)*4, self.view.frame.size.width, ((self.view.frame.size.height)/15)*2);
-        self.opacitySliderView.frame = CGRectMake(0, ((self.view.frame.size.height)/15)*8, self.view.frame.size.width, ((self.view.frame.size.height)/15)*2);
-        self.fillColorSelectView.frame = CGRectMake(0, ((self.view.frame.size.height)/15)*6, self.view.frame.size.width, ((self.view.frame.size.height)/15)*2);
-        self.thicknessView.frame = CGRectMake(0, ((self.view.frame.size.height)/15)*10, self.view.frame.size.width, ((self.view.frame.size.height)/15)*2);
-        self.dottedView.frame = CGRectMake(0, ((self.view.frame.size.height)/15)*12, self.view.frame.size.width, ((self.view.frame.size.height)/15)*2);
-        self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, ((self.view.frame.size.height)/15));
+        self.colorView.frame = CGRectMake(0, 120, self.view.frame.size.width, 90);
+        self.opacitySliderView.frame = CGRectMake(0, 300, self.view.frame.size.width, 90);
+        self.fillColorSelectView.frame = CGRectMake(0, 210, self.view.frame.size.width, 90);
+        self.thicknessView.frame = CGRectMake(0, 390, self.view.frame.size.width, 90);
+        self.dottedView.frame = CGRectMake(0, 470, self.view.frame.size.width, 90);
+        self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, 50);
     }
     
 }
@@ -89,8 +89,8 @@
     self.thicknessView.thicknessSlider.value = self.annotStyle.lineWidth;
     self.sampleView.thickness = self.annotStyle.lineWidth;
     self.dashPattern = (NSMutableArray *)self.annotStyle.dashPattern;
-    self.dottedView.thicknessSlider.value = [self.dashPattern[1] floatValue];
-    self.sampleView.dotted = [self.dashPattern[1] floatValue];
+    self.dottedView.thicknessSlider.value = [self.dashPattern.firstObject floatValue];
+    self.sampleView.dotted = self.dottedView.thicknessSlider.value;
     self.sampleView.fillShapeColor = self.annotStyle.interiorColor;
     [self.sampleView setNeedsDisplay];
 }
@@ -99,8 +99,33 @@
     self.sampleView.fillColor = self.annotStyle.color;
     self.sampleView.fillShapeColor = [UIColor whiteColor];
     self.sampleView.thickness = 4.0;
-    self.sampleView.selecIndex = self.index;
-    self.titleLabel.text = self.titles;
+    self.sampleView.selecIndex = (NSInteger)self.annotStyle.annotMode;
+    switch (self.annotStyle.annotMode) {
+        case CPDFViewAnnotationModeCircle:
+        {
+            self.titleLabel.text = NSLocalizedString(@"Circle", nil);
+        }
+            break;
+        case CPDFViewAnnotationModeSquare:
+        {
+            self.titleLabel.text = NSLocalizedString(@"Square", nil);
+        }
+            break;
+        case CPDFViewAnnotationModeArrow:
+        {
+            self.titleLabel.text = NSLocalizedString(@"Arrow", nil);
+        }
+            break;
+        case CPDFViewAnnotationModeLine:
+        {
+            self.titleLabel.text = NSLocalizedString(@"Line", nil);
+        }
+            break;
+            
+        default:
+            break;
+    }
+    
     self.fillColorSelectView.colorLabel.text = NSLocalizedString(@"Fill", nil);
     self.thicknessView.titleLabel.text = NSLocalizedString(@"Thickness", nil);
     self.colorView.colorLabel.text = NSLocalizedString(@"Border", nil);
@@ -108,7 +133,7 @@
 }
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 370 : 660);
+    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 660);
 }
 
 #pragma mark - CPDFOpacitySliderViewDelegate

+ 5 - 0
compdfkit-tools/compdfkit-tools/Common/Model/CAnnotStyle.m

@@ -159,10 +159,15 @@
 
 @property (nonatomic, strong) NSArray *annotations;
 
+@property (nonatomic, assign) CPDFViewAnnotationMode annotMode;
+
+@property (nonatomic, assign) BOOL isSelectAnnot;
+
 @end
 
 @implementation CAnnotStyle
 
+
 - (instancetype)initWithAnnotionMode:(CPDFViewAnnotationMode)annotionMode annotations:(NSArray *)annotations {
     if (self = [super init]) {
         if(annotations.count > 0) {

+ 108 - 19
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m

@@ -34,7 +34,7 @@
 
 #import <ComPDFKit/ComPDFKit.h>
 
-@interface CPDFAnnotationBar () <CPDFSignatureViewControllerDelegate, CPDFSignatureEditViewControllerDelegate, CPDFNoteViewControllerDelegate, CPDFShapeCircleViewControllerDelegate, CPDFHighlightViewControllerDelegate, CPDFUnderlineViewControllerDelegate, CPDFStrikeoutViewControllerDelegate, CPDFSquigglyViewControllerDelegate>
+@interface CPDFAnnotationBar () <CPDFSignatureViewControllerDelegate, CPDFSignatureEditViewControllerDelegate, CPDFNoteViewControllerDelegate, CPDFShapeCircleViewControllerDelegate, CPDFHighlightViewControllerDelegate, CPDFUnderlineViewControllerDelegate, CPDFStrikeoutViewControllerDelegate, CPDFSquigglyViewControllerDelegate, CPDFInkTopToolBarDelegate, CPDFInkViewControllerDelegate, CPDFShapeArrowViewControllerDelegate>
 
 @property (nonatomic, strong) UIScrollView *scrollView;
 
@@ -250,13 +250,15 @@
         
         [self.annotManage setAnnotStyleFromMode:self.selectedIndex];
     } else {
+        self.propertiesBtn.enabled = NO;
         self.pdfListView.annotationMode = CPDFViewAnnotationModeNone;
         self.selectedIndex = -1;
         button.backgroundColor = [UIColor clearColor];
     }
     
-    self.propertiesBtn.tag = self.selectedIndex;
     [self updatePropertiesButtonState];
+    
+    [self createInkTopToolBar];
 }
 
 - (void)buttonItemClicked_open:(UIButton *)button {
@@ -316,24 +318,15 @@
         case CPDFToolbarFreehand:
         {
             CPDFInkViewController *inkVC = [[CPDFInkViewController alloc] initWithStyle:annotStytle];
+            inkVC.delegate = self;
             presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:inkVC presentingViewController:self.parentVC];
             inkVC.transitioningDelegate = presentationController;
             [self.parentVC presentViewController:inkVC animated:YES completion:nil];
-            
-            if (@available(iOS 11.0, *)) {
-                self.topToolBar = [[CPDFInkTopToolBar alloc] initWithFrame:CGRectMake(50, self.parentVC.view.safeAreaInsets.top, self.parentVC.view.frame.size.width-100, 50)];
-                self.topToolBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-                [self.parentVC.view addSubview:self.topToolBar];
-            } else {
-                self.topToolBar = [[CPDFInkTopToolBar alloc] initWithFrame:CGRectMake(50, 64, self.parentVC.view.frame.size.width-100, 50)];
-                self.topToolBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-                [self.parentVC.view addSubview:self.topToolBar];
-            }
         }
             break;
         case CPDFToolbarShapeCircle:
         {
-            CPDFShapeCircleViewController *circleVC = [[CPDFShapeCircleViewController alloc] initWithStyle:annotStytle selectIndex:CPDFToolbarShapeCircle title:@"Circle"];
+            CPDFShapeCircleViewController *circleVC = [[CPDFShapeCircleViewController alloc] initWithStyle:annotStytle];
             circleVC.delegate = self;
             presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:circleVC presentingViewController:self.parentVC];
             circleVC.transitioningDelegate = presentationController;
@@ -342,15 +335,18 @@
             break;
         case CPDFToolbarShapeRectangle:
         {
-            CPDFShapeCircleViewController *circleVC = [[CPDFShapeCircleViewController alloc] initWithStyle:annotStytle selectIndex:CPDFToolbarShapeRectangle title:@"Rectangle"];
-            presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:circleVC presentingViewController:self.parentVC];
-            circleVC.transitioningDelegate = presentationController;
-            [self.parentVC presentViewController:circleVC animated:YES completion:nil];
+            CPDFShapeCircleViewController *squareVC = [[CPDFShapeCircleViewController alloc] initWithStyle:annotStytle];
+            squareVC.delegate = self;
+            
+            presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:squareVC presentingViewController:self.parentVC];
+            squareVC.transitioningDelegate = presentationController;
+            [self.parentVC presentViewController:squareVC animated:YES completion:nil];
         }
             break;
         case CPDFToolbarShapeArrow:
         {
-            CPDFShapeArrowViewController *arrowVC = [[CPDFShapeArrowViewController alloc] initWithStyle:annotStytle selectIndex:CPDFToolbarShapeArrow title:@"Arrow"];
+            CPDFShapeArrowViewController *arrowVC = [[CPDFShapeArrowViewController alloc] initWithStyle:annotStytle];
+            arrowVC.lineDelegate = self;
             presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:arrowVC presentingViewController:self.parentVC];
             arrowVC.transitioningDelegate = presentationController;
             [self.parentVC presentViewController:arrowVC animated:YES completion:nil];
@@ -358,7 +354,8 @@
             break;
         case CPDFToolbarShapeLine:
         {
-            CPDFShapeArrowViewController *lineVC = [[CPDFShapeArrowViewController alloc] initWithStyle:annotStytle selectIndex:CPDFToolbarShapeLine title:@"Line"];
+            CPDFShapeArrowViewController *lineVC = [[CPDFShapeArrowViewController alloc] initWithStyle:annotStytle];
+            lineVC.lineDelegate = self;
             presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:lineVC presentingViewController:self.parentVC];
             lineVC.transitioningDelegate = presentationController;
             [self.parentVC presentViewController:lineVC animated:YES completion:nil];
@@ -398,6 +395,26 @@
     }
 }
 
+#pragma mark - Private Methods
+
+- (void)createInkTopToolBar {
+    if (CPDFViewAnnotationModeInk == self.selectedIndex) {
+        if (@available(iOS 11.0, *)) {
+            self.topToolBar = [[CPDFInkTopToolBar alloc] initWithFrame:CGRectMake(50, self.parentVC.view.safeAreaInsets.top, self.parentVC.view.frame.size.width-100, 50)];
+            self.topToolBar.delegate = self;
+            
+            self.topToolBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [self.parentVC.view addSubview:self.topToolBar];
+        } else {
+            self.topToolBar = [[CPDFInkTopToolBar alloc] initWithFrame:CGRectMake(50, 64, self.parentVC.view.frame.size.width-100, 50)];
+            self.topToolBar.delegate = self;
+            self.topToolBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [self.parentVC.view addSubview:self.topToolBar];
+        }
+        self.alpha = 0.0;
+    }
+}
+
 #pragma mark - CPDFSignatureViewControllerDelegate
 
 - (void)signatureViewController:(CPDFSignatureViewController *)signatureViewController {
@@ -472,6 +489,78 @@
     }
 }
 
+#pragma mark - CPDFAnnotationBarDelegate
+
+- (void)inkTopToolBar:(CPDFInkTopToolBar *)inkTopToolBar tag:(NSInteger)tag isSelect:(BOOL)isSelect {
+    switch (tag) {
+        case CPDFInkTopToolBarSetting:
+        {
+            CAnnotStyle *annotStytle = self.annotManage.annotStyle;
+            AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
+            CPDFInkViewController *inkVC = [[CPDFInkViewController alloc] initWithStyle:annotStytle];
+            inkVC.delegate = self;
+            presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:inkVC presentingViewController:self.parentVC];
+            inkVC.transitioningDelegate = presentationController;
+            [self.parentVC presentViewController:inkVC animated:YES completion:nil];
+        }
+            break;
+        case CPDFInkTopToolBarErase:
+        {
+            [self.annotManage.pdfListView setDrawErasing:isSelect];
+        }
+            break;
+        case CPDFInkTopToolBarUndo:
+        {
+            [self.annotManage.pdfListView drawUndo];
+        }
+            break;
+        case CPDFInkTopToolBarRedo:
+        {
+            [self.annotManage.pdfListView drawRedo];
+        }
+            break;
+        case CPDFInkTopToolBarClear:
+        {
+            self.alpha = 1.0;
+            self.selectedIndex = -1;
+            [self reloadData];
+            self.annotManage.pdfListView.annotationMode = CPDFViewAnnotationModeNone;
+        }
+            break;
+        case CPDFInkTopToolBarSave:
+        {
+            self.alpha = 1.0;
+            self.selectedIndex = -1;
+            [self reloadData];
+            [self.annotManage.pdfListView commitDrawing];
+            self.annotManage.pdfListView.annotationMode = CPDFViewAnnotationModeNone;
+        }
+    
+        default:
+            break;
+    }
+}
+
+#pragma mark - CPDFInkViewControllerDelegate
+
+- (void)inkViewController:(CPDFInkViewController *)inkViewController annotStyle:(CAnnotStyle *)annotStyle {
+    if (annotStyle.isSelectAnnot) {
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
+    } else {
+        
+    }
+}
+
+#pragma mark - CPDFShapeArrowViewControllerDelegate
+
+- (void)arrowViewController:(CPDFShapeArrowViewController *)arrowViewController annotStyle:(CAnnotStyle *)annotStyle {
+    if (annotStyle.isSelectAnnot) {
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
+    } else {
+        
+    }
+}
+
 #pragma mark - NSNotification
 
 - (void)annotationsOperationChangeNotification:(NSNotification *)notification {

+ 13 - 2
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFAnnotationSampleView.h

@@ -31,13 +31,24 @@ typedef NS_ENUM(NSInteger, CPDFSamplesSelectedIndex) {
     CPDFSamplesSound,
 };
 
+typedef NS_ENUM(NSInteger, CPDFArrowStyle) {
+    CPDFArrowStyleNone = 0,
+    CPDFArrowStyleOpenArrow = 1,
+    CPDFArrowStyleClosedArrow = 2,
+    CPDFArrowStyleSquare = 3,
+    CPDFArrowStyleCircle = 4,
+    CPDFArrowStyleDiamond = 5
+};
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFAnnotationSampleView : UIView
 
 @property (nonatomic, assign) CPDFSamplesSelectedIndex selecIndex;
 
-@property (nonatomic, assign) NSInteger arrowStyleIndex;
+@property (nonatomic, assign) CPDFArrowStyle startArrowStyleIndex;
+
+@property (nonatomic, assign) CPDFArrowStyle endArrowStyleIndex;
 
 @property (nonatomic, strong) UIColor *fillColor;
 
@@ -53,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL isBold;
 
-@property (nonatomic, assign) BOOL isUnderline;
+@property (nonatomic, assign) BOOL isItalic;
 
 @end
 

+ 81 - 61
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFAnnotationSampleView.m

@@ -173,45 +173,38 @@
             CGContextFillRect(context, self.centerRect);
         }
             break;
-        case CPDFSamplesShapeArrow:
+        case CPDFSamplesShapeArrow ... CPDFSamplesShapeLine:
         {
             CGContextSetStrokeColorWithColor(context, self.fillColor.CGColor);
-            CGContextSetFillColorWithColor(context, self.fillColor.CGColor);
-            CGFloat dashLengths[2] = {6, self.dotted};
-            CGContextSetLineDash(context, 0, dashLengths, 2);
             CGContextSetLineWidth(context, self.thickness);
-            
             CGPoint start = CGPointMake(CGRectGetMinX(self.arrowRect), CGRectGetMaxY(self.arrowRect));
             CGPoint end = CGPointMake(CGRectGetMaxX(self.arrowRect), CGRectGetMinY(self.arrowRect));
-            [self drawArrow:context startPoint:start endPoint:end];
-        }
-            break;
-        case CPDFSamplesShapeLine:
-        {
-            CGContextSetStrokeColorWithColor(context, self.fillColor.CGColor);
-            CGContextSetFillColorWithColor(context, self.fillColor.CGColor);
+            [self drawEndArrow:context startPoint:start endPoint:end];
+            [self drawStartArrow:context startPoint:start endPoint:end];
             CGFloat dashLengths[2] = {6, self.dotted};
             CGContextSetLineDash(context, 0, dashLengths, 2);
-            CGContextSetLineWidth(context, self.thickness);
-            
-            CGPoint start = CGPointMake(CGRectGetMinX(self.arrowRect), CGRectGetMaxY(self.arrowRect));
-            CGPoint end = CGPointMake(CGRectGetMaxX(self.arrowRect), CGRectGetMinY(self.arrowRect));
-            [self drawArrow:context startPoint:start endPoint:end];
+            CGContextMoveToPoint(context, start.x, start.y);
+            CGContextAddLineToPoint(context, end.x, end.y);
+            CGContextStrokePath(context);
         }
             break;
         case CPDFSamplesFreeText:
         {
-            NSString *sampleStr = @"AaBbCc";
+            NSString *sampleStr = @"Sample";
             CGContextSetAlpha(context, self.opcity);
             UIFont *font = [UIFont fontWithName:self.fontName size:self.thickness];
             NSMutableDictionary *dic = [NSMutableDictionary dictionary];
-            if (self.isBold && !(self.isUnderline)) {
+            if (self.isBold && !(self.isItalic)) {
                 font = [UIFont boldSystemFontOfSize:self.thickness];
-            } else if (self.isUnderline && !(self.isBold)) {
-                [dic addEntriesFromDictionary:@{NSFontAttributeName:font, NSUnderlineStyleAttributeName:@1}];
-            } else if (self.isBold && self.isUnderline) {
+            } else if (self.isItalic && !(self.isBold)) {
+                font = [UIFont italicSystemFontOfSize:self.thickness];
+                
+            } else if (self.isBold && self.isItalic) {
                 font = [UIFont boldSystemFontOfSize:self.thickness];
-                [dic addEntriesFromDictionary:@{NSFontAttributeName:font, NSUnderlineStyleAttributeName:@1}];
+                font = [UIFont italicSystemFontOfSize:self.thickness];
+            }
+            if (!self.fillColor) {
+                self.fillColor = [UIColor whiteColor];
             }
             [dic addEntriesFromDictionary:@{NSFontAttributeName:font, NSForegroundColorAttributeName:self.fillColor}];
             [sampleStr drawInRect:self.arrowRect withAttributes:dic];
@@ -222,72 +215,99 @@
     }
 }
 
-- (void)drawArrow:(CGContextRef)context startPoint:(CGPoint)start endPoint:(CGPoint)end {
-    switch (self.arrowStyleIndex) {
-        case 0:
+- (void)drawStartArrow:(CGContextRef)context startPoint:(CGPoint)start endPoint:(CGPoint)end {
+    switch (self.startArrowStyleIndex) {
+        case CPDFArrowStyleOpenArrow:
         {
-            CGContextMoveToPoint(context, start.x, start.y);
-            CGContextAddLineToPoint(context, end.x, end.y);
+            CGContextMoveToPoint(context, start.x+10, start.y);
+            CGContextAddLineToPoint(context, start.x, start.y);
+            CGContextAddLineToPoint(context, start.x, start.y-10);
             CGContextStrokePath(context);
         }
             break;
-        case 1:
+        case CPDFArrowStyleClosedArrow:
         {
-            CGContextMoveToPoint(context, start.x, start.y);
-            CGContextAddLineToPoint(context, end.x, end.y);
-            
-            CGContextMoveToPoint(context, end.x-20, end.y);
-            CGContextAddLineToPoint(context, end.x, end.y);
-            CGContextAddLineToPoint(context, end.x, end.y+20);
+            CGContextMoveToPoint(context, start.x-7.5, start.y-7.5);
+            CGContextAddLineToPoint(context, start.x-7.5, start.y+7.5);
+            CGContextAddLineToPoint(context, start.x+7.5, start.y+7.5);
+            CGContextClosePath(context);
             CGContextStrokePath(context);
         }
             break;
-        case 2:
+        case CPDFArrowStyleSquare:
         {
-            CGContextMoveToPoint(context, start.x, start.y);
-            CGContextAddLineToPoint(context, end.x, end.y);
+            CGContextMoveToPoint(context, start.x-5, start.y-5);
+            CGContextAddLineToPoint(context, start.x+5, start.y+5);
+            CGContextAddLineToPoint(context, start.x-5, start.y+15);
+            CGContextAddLineToPoint(context, start.x-15, start.y+5);
+            CGContextClosePath(context);
             CGContextStrokePath(context);
-            
-            CGContextMoveToPoint(context, end.x-7.5, end.y-7.5);
-            CGContextAddLineToPoint(context, end.x+15, end.y-15);
-            CGContextAddLineToPoint(context, end.x+7.5, end.y+7.5);
-            CGContextFillPath(context);
         }
             break;
-        case 3:
+        case CPDFArrowStyleCircle:
+        {
+            CGContextAddArc(context, start.x-7.5, start.y+7.5, 10, 0, 2*3.14159265358979323846, 0);
+            CGContextDrawPath(context, kCGPathStroke);
+        }
+            break;
+        case CPDFArrowStyleDiamond:
         {
             CGContextMoveToPoint(context, start.x, start.y);
+            CGContextAddLineToPoint(context, start.x-10, start.y);
+            CGContextAddLineToPoint(context, start.x-10, start.y+10);
+            CGContextAddLineToPoint(context, start.x, start.y+10);
+            CGContextClosePath(context);
+            CGContextStrokePath(context);
+        }
+            break;
+        default:
+            break;
+    }
+}
+
+- (void)drawEndArrow:(CGContextRef)context startPoint:(CGPoint)start endPoint:(CGPoint)end {
+    switch (self.endArrowStyleIndex) {
+        case CPDFArrowStyleOpenArrow:
+        {
+            CGContextMoveToPoint(context, end.x-15, end.y);
             CGContextAddLineToPoint(context, end.x, end.y);
+            CGContextAddLineToPoint(context, end.x, end.y+15);
             CGContextStrokePath(context);
-            
+        }
+            break;
+        case CPDFArrowStyleClosedArrow:
+        {
             CGContextMoveToPoint(context, end.x-7.5, end.y-7.5);
+            CGContextAddLineToPoint(context, end.x+7.5, end.y-7.5);
             CGContextAddLineToPoint(context, end.x+7.5, end.y+7.5);
-            CGContextAddLineToPoint(context, end.x+22.5, end.y-7.5);
-            CGContextAddLineToPoint(context, end.x+7.5, end.y-22.5);
-            CGContextFillPath(context);
+            CGContextClosePath(context);
+            CGContextStrokePath(context);
         }
             break;
-        case 4:
+        case CPDFArrowStyleSquare:
         {
-            CGContextMoveToPoint(context, start.x, start.y);
-            CGContextAddLineToPoint(context, end.x, end.y);
+            CGContextMoveToPoint(context, end.x-5, end.y-5);
+            CGContextAddLineToPoint(context, end.x+5, end.y+5);
+            CGContextAddLineToPoint(context, end.x+15, end.y-5);
+            CGContextAddLineToPoint(context, end.x+5, end.y-15);
+            CGContextClosePath(context);
             CGContextStrokePath(context);
-            
+        }
+            break;
+        case CPDFArrowStyleCircle:
+        {
             CGContextAddArc(context, end.x+7.5, end.y-7.5, 10, 0, 2*3.14159265358979323846, 0);
             CGContextDrawPath(context, kCGPathStroke);
         }
             break;
-        case 5:
+        case CPDFArrowStyleDiamond:
         {
-            CGContextMoveToPoint(context, start.x, start.y);
-            CGContextAddLineToPoint(context, end.x, end.y);
-            CGContextStrokePath(context);
-            
             CGContextMoveToPoint(context, end.x, end.y);
-            CGContextAddLineToPoint(context, end.x+15, end.y);
-            CGContextAddLineToPoint(context, end.x+15, end.y-15);
-            CGContextAddLineToPoint(context, end.x, end.y-15);
-            CGContextFillPath(context);
+            CGContextAddLineToPoint(context, end.x+10, end.y);
+            CGContextAddLineToPoint(context, end.x+10, end.y-10);
+            CGContextAddLineToPoint(context, end.x, end.y-10);
+            CGContextClosePath(context);
+            CGContextStrokePath(context);
         }
             break;
         default:

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

@@ -35,7 +35,8 @@
     if (self = [super initWithFrame:frame]) {
         self.colorLabel = [[UILabel alloc] init];
         self.colorLabel.text = NSLocalizedString(@"Color", nil);
-        self.colorLabel.adjustsFontSizeToFitWidth = YES;
+        self.colorLabel.textColor = [UIColor grayColor];
+        self.colorLabel.font = [UIFont systemFontOfSize:12.0];
         [self addSubview:self.colorLabel];
         
         self.colorPickerView = [[UIView alloc] initWithFrame:CGRectMake(0, 30, self.bounds.size.width, 60)];

+ 4 - 3
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFOpacitySliderView.m

@@ -20,8 +20,9 @@
     if (self = [super initWithFrame:frame]) {
         self.titleLabel = [[UILabel alloc] init];
         self.titleLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
-        self.titleLabel.text = NSLocalizedString(@"Opacity:", nil);
-        self.titleLabel.adjustsFontSizeToFitWidth = YES;
+        self.titleLabel.text = NSLocalizedString(@"Opacity", nil);
+        self.titleLabel.textColor = [UIColor grayColor];
+        self.titleLabel.font = [UIFont systemFontOfSize:12.0];
         [self addSubview:self.titleLabel];
         
         self.opacitySlider = [[UISlider alloc] init];
@@ -49,7 +50,7 @@
     [super layoutSubviews];
     self.titleLabel.frame = CGRectMake(10, 0, 50, self.frame.size.height/2);
     self.opacitySlider.frame = CGRectMake(10, self.frame.size.height/2, self.frame.size.width - 110, self.frame.size.height/2);
-    self.startLabel.frame = CGRectMake(self.frame.size.width - 90, self.frame.size.height/2, 80, self.frame.size.height/2);
+    self.startLabel.frame = CGRectMake(self.frame.size.width - 90, self.frame.size.height/2 + 10, 80, self.frame.size.height/2 - 20);
 }
 
 #pragma mark - Action

+ 5 - 3
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFThicknessSliderView.m

@@ -21,7 +21,8 @@
         self.titleLabel = [[UILabel alloc] init];
         self.titleLabel.text = NSLocalizedString(@"Thickeness", nil);
         self.titleLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
-        self.titleLabel.adjustsFontSizeToFitWidth = YES;
+        self.titleLabel.textColor = [UIColor grayColor];
+        self.titleLabel.font = [UIFont systemFontOfSize:12.0];
         [self addSubview:self.titleLabel];
         
         self.thicknessSlider = [[UISlider alloc] init];
@@ -37,6 +38,7 @@
         self.startLabel.textAlignment = NSTextAlignmentCenter;
         self.startLabel.layer.cornerRadius = 6.0;
         self.startLabel.layer.masksToBounds = YES;
+        self.startLabel.layer.borderColor = [UIColor grayColor].CGColor;
         self.startLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
         [self addSubview:self.startLabel];
     }
@@ -45,9 +47,9 @@
 
 - (void)layoutSubviews {
     [super layoutSubviews];
-    self.titleLabel.frame = CGRectMake(10, 0, 50, self.frame.size.height/2);
+    self.titleLabel.frame = CGRectMake(10, 0, 70, self.frame.size.height/2);
     self.thicknessSlider.frame = CGRectMake(10, self.frame.size.height/2, self.frame.size.width - 110, self.frame.size.height/2);
-    self.startLabel.frame = CGRectMake(self.frame.size.width - 90, self.frame.size.height/2, 80, self.frame.size.height/2);
+    self.startLabel.frame = CGRectMake(self.frame.size.width - 90, self.frame.size.height/2 + 10, 80, self.frame.size.height/2 -20);
 }
 
 #pragma mark - Action