Prechádzať zdrojové kódy

PDFEdit(iOS) - 文字弹出部分 颜色框比例适当调整

chenyu 1 rok pred
rodič
commit
d5ed4587ac

+ 9 - 3
compdfkit-tools/compdfkit-tools/Edit/CPDFEditCell/CPDFTextPropertyCell.m

@@ -12,7 +12,7 @@
 #import "CPDFColorSelectView.h"
 #import "CPDFOpacitySliderView.h"
 
-@interface CPDFTextPropertyCell()
+@interface CPDFTextPropertyCell()<CPDFColorSelectViewDelegate>
 @property (weak, nonatomic) IBOutlet UIView *colorAreaView;
 @property (nonatomic, strong) CPDFColorSelectView * colorView;
 @property (weak, nonatomic) IBOutlet UIView *sliderArea;
@@ -32,13 +32,16 @@
     [super awakeFromNib];
     // Initialization code
     if(!self.colorView){
-        self.colorView  = [[CPDFColorSelectView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 90)];
+        self.colorView  = [[CPDFColorSelectView alloc] initWithFrame:CGRectMake(10, 0, self.frame.size.width-20, 90)];
+        self.colorView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+        self.colorView.delegate = self;
         [self.colorAreaView addSubview:self.colorView];
     }
     
 
     if(!self.opacityView){
-        self.opacityView = [[CPDFOpacitySliderView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 90)];
+        self.opacityView = [[CPDFOpacitySliderView alloc] initWithFrame:CGRectMake(10, 0, self.frame.size.width-20, 90)];
+        self.opacityView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
         [self.sliderArea addSubview:self.opacityView];
     }
 }
@@ -49,4 +52,7 @@
     // Configure the view for the selected state
 }
 
+#pragma mark - CPDFColorSelectViewDelegate
+
+
 @end

+ 7 - 7
compdfkit-tools/compdfkit-tools/Edit/CPDFEditCell/CPDFTextPropertyCell.xib

@@ -19,7 +19,7 @@
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uhx-SF-mln">
-                        <rect key="frame" x="10" y="10" width="338" height="90"/>
+                        <rect key="frame" x="0.0" y="10" width="358" height="90"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="90" id="INN-EU-pwF"/>
@@ -64,7 +64,7 @@
                         <state key="selected" image="CPDFEditAlignmentLeftHigh"/>
                     </button>
                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ohh-qk-Inu">
-                        <rect key="frame" x="10" y="215.66666666666663" width="338" height="90"/>
+                        <rect key="frame" x="0.0" y="215.66666666666663" width="358" height="90"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="90" id="dE5-pY-qzE"/>
@@ -84,17 +84,15 @@
                     </button>
                 </subviews>
                 <constraints>
-                    <constraint firstItem="ohh-qk-Inu" firstAttribute="leading" secondItem="lXb-G8-H3F" secondAttribute="leading" id="682-0L-tII"/>
-                    <constraint firstItem="3ni-3O-NWD" firstAttribute="leading" secondItem="uhx-SF-mln" secondAttribute="leading" id="9Fl-ke-nOj"/>
                     <constraint firstItem="tx4-bt-cUh" firstAttribute="leading" secondItem="H2Y-8R-CMe" secondAttribute="trailing" constant="20" id="An4-9q-kCf"/>
-                    <constraint firstAttribute="trailing" secondItem="uhx-SF-mln" secondAttribute="trailing" constant="10" id="CcO-Mn-VMl"/>
+                    <constraint firstAttribute="trailing" secondItem="uhx-SF-mln" secondAttribute="trailing" id="CcO-Mn-VMl"/>
                     <constraint firstItem="H2Y-8R-CMe" firstAttribute="height" secondItem="tx4-bt-cUh" secondAttribute="height" multiplier="0.875" id="EOq-0u-oce"/>
-                    <constraint firstAttribute="trailing" secondItem="ohh-qk-Inu" secondAttribute="trailing" constant="10" id="Hnl-9t-9H0"/>
+                    <constraint firstAttribute="trailing" secondItem="ohh-qk-Inu" secondAttribute="trailing" id="Hnl-9t-9H0"/>
                     <constraint firstAttribute="trailing" secondItem="SQc-1y-yHE" secondAttribute="trailing" constant="10" id="J4d-yv-7u0"/>
                     <constraint firstItem="VsT-rp-W0E" firstAttribute="leading" secondItem="n1n-vD-767" secondAttribute="trailing" constant="20" id="KO2-f1-XVf"/>
                     <constraint firstItem="VsT-rp-W0E" firstAttribute="centerY" secondItem="SQc-1y-yHE" secondAttribute="centerY" id="M1e-vD-VJ5"/>
                     <constraint firstItem="lXb-G8-H3F" firstAttribute="top" secondItem="3ni-3O-NWD" secondAttribute="bottom" constant="24" id="NoF-ZO-9Xz"/>
-                    <constraint firstItem="uhx-SF-mln" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="ONy-qh-BWJ"/>
+                    <constraint firstItem="uhx-SF-mln" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="ONy-qh-BWJ"/>
                     <constraint firstItem="ohh-qk-Inu" firstAttribute="top" secondItem="SQc-1y-yHE" secondAttribute="bottom" constant="20" id="VCF-iN-cJh"/>
                     <constraint firstItem="3ni-3O-NWD" firstAttribute="top" secondItem="uhx-SF-mln" secondAttribute="bottom" constant="30" id="VD8-pK-fua"/>
                     <constraint firstItem="SQc-1y-yHE" firstAttribute="leading" secondItem="VsT-rp-W0E" secondAttribute="trailing" constant="20" id="VRg-RR-Wid"/>
@@ -102,7 +100,9 @@
                     <constraint firstItem="lXb-G8-H3F" firstAttribute="leading" secondItem="3ni-3O-NWD" secondAttribute="leading" id="Xjv-F8-Ayu"/>
                     <constraint firstItem="uhx-SF-mln" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="ahr-dh-XdX"/>
                     <constraint firstItem="n1n-vD-767" firstAttribute="centerY" secondItem="VsT-rp-W0E" secondAttribute="centerY" id="dT4-ef-cLa"/>
+                    <constraint firstItem="3ni-3O-NWD" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="e1S-Zj-dYo"/>
                     <constraint firstItem="tx4-bt-cUh" firstAttribute="centerY" secondItem="3ni-3O-NWD" secondAttribute="centerY" id="fFJ-sa-EN4"/>
+                    <constraint firstItem="ohh-qk-Inu" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="iKM-NL-byz"/>
                     <constraint firstItem="SQc-1y-yHE" firstAttribute="centerY" secondItem="lXb-G8-H3F" secondAttribute="centerY" id="vPZ-NC-AKb"/>
                     <constraint firstItem="H2Y-8R-CMe" firstAttribute="width" secondItem="tx4-bt-cUh" secondAttribute="width" id="vRw-fM-hZK"/>
                     <constraint firstItem="H2Y-8R-CMe" firstAttribute="centerY" secondItem="tx4-bt-cUh" secondAttribute="centerY" id="wMP-WK-vLX"/>

+ 8 - 2
compdfkit-tools/compdfkit-tools/Edit/CPDFEditToolBar/CPDFEditToolBar.m

@@ -89,7 +89,7 @@
     
     self.undoButton = [UIButton buttonWithType:UIButtonTypeCustom];
     self.undoButton.frame = CGRectMake(CGRectGetMaxX(self.propertyButton.frame) + 25, 20, 20, 20);
-    [self.undoButton addTarget:self action:@selector(redoAction:) forControlEvents:UIControlEventTouchUpInside];
+    [self.undoButton addTarget:self action:@selector(undoAction:) forControlEvents:UIControlEventTouchUpInside];
     [self.undoButton setBackgroundImage:[UIImage imageNamed:@"CPDFEditUndo" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     
     [self.undoButton setBackgroundImage:[UIImage imageNamed:@"CPDFEditUndoDisable" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateDisabled];
@@ -98,7 +98,7 @@
     
     self.redoButton = [UIButton buttonWithType:UIButtonTypeCustom];
     self.redoButton.frame = CGRectMake(CGRectGetMaxX(self.undoButton.frame) + 25, 20,20, 20);
-    [self.redoButton addTarget:self action:@selector(undoAction:) forControlEvents:UIControlEventTouchUpInside];
+    [self.redoButton addTarget:self action:@selector(redoAction:) forControlEvents:UIControlEventTouchUpInside];
      [self.redoButton setBackgroundImage:[UIImage imageNamed:@"CPDFEditRedo" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
     [self.redoButton setBackgroundImage:[UIImage imageNamed:@"CPDFEditRedoDisable" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateDisabled];
     
@@ -113,6 +113,9 @@
 
 - (void)textEditAction:(UIButton*)sender {
     sender.selected = !sender.selected;
+    if(sender.selected == YES){
+        [self.imageEditButton setSelected:NO];
+    }
     
     if(sender.selected == NO && self.imageEditButton.selected == NO){
         if(self.delegate && [self.delegate respondsToSelector:@selector(editClickInToolBar:editMode:)]){
@@ -127,6 +130,9 @@
 
 - (void)imageEditAction:(UIButton*)sender {
     sender.selected = !sender.selected;
+    if(sender.selected == YES){
+        [self.textEditButton setSelected:NO];
+    }
     if(sender.selected == NO && self.textEditButton.selected == NO){
         if(self.delegate && [self.delegate respondsToSelector:@selector(editClickInToolBar:editMode:)]){
             [self.delegate editClickInToolBar:self editMode:CPDFEditModeAll];