瀏覽代碼

PDFTools(iOS) - 修复斜体粗体的UI bug

chenyu 1 年之前
父節點
當前提交
8e007949f5
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15 2
      compdfkit-tools/compdfkit-tools/Form/View/CPDFFontSettingView.m

+ 15 - 2
compdfkit-tools/compdfkit-tools/Form/View/CPDFFontSettingView.m

@@ -93,6 +93,19 @@
     
     self.fontSelectBtn.frame = self.dropMenuView.bounds;
     self.styleView.frame  = CGRectMake(self.frame.size.width - 100, 0, 80, 30);
+    
+    //bold
+    UIBezierPath *maskPath=[UIBezierPath bezierPathWithRoundedRect:self.boldBtn.bounds byRoundingCorners:UIRectCornerTopLeft |UIRectCornerBottomLeft cornerRadii:CGSizeMake(4, 4)];
+    CAShapeLayer *maskLayer=[[CAShapeLayer alloc]init];
+    maskLayer.frame = self.boldBtn.bounds;
+    maskLayer.path = maskPath.CGPath;
+    self.boldBtn.layer.mask = maskLayer;
+    
+    UIBezierPath *maskPath1=[UIBezierPath bezierPathWithRoundedRect:self.italicBtn.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerBottomRight cornerRadii:CGSizeMake(4, 4)];
+    CAShapeLayer *maskLayer1 =[[CAShapeLayer alloc]init];
+    maskLayer1.frame = self.italicBtn.bounds;
+    maskLayer1.path = maskPath1.CGPath;
+    self.italicBtn.layer.mask = maskLayer1;
 }
 
 - (IBAction)fontBoldAction:(UIButton *)sender {
@@ -141,9 +154,9 @@
 -(void)setIsItalic:(BOOL)isItalic {
     _isItalic = isItalic;
     if(isItalic) {
-        [self.boldBtn setBackgroundColor:[UIColor colorWithRed:221/255. green:223/255. blue:255/255. alpha:1.]];
+        [self.italicBtn setBackgroundColor:[UIColor colorWithRed:221/255. green:223/255. blue:255/255. alpha:1.]];
     }else{
-        [self.boldBtn setBackgroundColor:[UIColor clearColor]];
+        [self.italicBtn setBackgroundColor:[UIColor clearColor]];
     }
     
     [self.italicBtn setSelected:isItalic];