瀏覽代碼

PDFTools(iOS) - 主动刷新UI

chenyu 1 年之前
父節點
當前提交
ec4ed1adce

+ 17 - 5
compdfkit-tools/compdfkit-tools/Form/Controller/CPDFFormComboxViewController.m

@@ -228,11 +228,6 @@
 
 - (void)buttonItemClicked_back:(id)sender {
     
-    NSString * fontName = [self constructionFontname:self.baseName isBold:self.isBold isItalic:self.isItalic];
-    self.comboxChoiceWidget.font = [UIFont fontWithName:fontName size:self.fontSize];
-    CPDFPage *page = self.comboxChoiceWidget.page;
-    [self.annotManage.pdfListView setNeedsDisplayForPage:page];
-    
     [self dismissViewControllerAnimated:YES completion:nil];
 }
 
@@ -284,6 +279,7 @@
 
 - (void)SetCPDFFormTextFiledView:(CPDFFormTextFieldView *)view text:(NSString *)completedText {
     self.comboxChoiceWidget.fieldName = completedText;
+    [self refreshUI];
 }
 
 
@@ -301,6 +297,7 @@
     }else if(select == self.textColorView) {
         self.comboxChoiceWidget.fontColor = color;
     }
+    [self refreshUI];
 }
 
 - (void)selectColorView:(CPDFColorSelectView *)select {
@@ -316,6 +313,7 @@
         self.colorPicker.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
         [self.view addSubview:self.colorPicker];
     }
+    [self refreshUI];
 }
 
 
@@ -333,6 +331,7 @@
     }else if(self.currentSelectColorView == self.textColorView) {
         self.comboxChoiceWidget.fontColor = color;
     }
+    [self refreshUI];
 }
 
 #pragma mark - UIColorPickerViewControllerDelegate
@@ -349,26 +348,31 @@
     }else if(self.currentSelectColorView == self.textColorView) {
         self.comboxChoiceWidget.fontColor = viewController.selectedColor;
     }
+    [self refreshUI];
 }
 
 #pragma mark - CPDFFormSwitchViewDelegate
 - (void)SwitchActionInView:(CPDFFormSwitchView *)view switcher:(UISwitch *)switcher {
     [self.comboxChoiceWidget setHidden:switcher.on];
+    [self refreshUI];
 }
 
 #pragma mark - CPDFThicknessSliderViewDelegate
 - (void)thicknessSliderView:(CPDFThicknessSliderView *)thicknessSliderView thickness:(CGFloat)thickness {
     self.fontSize = thickness * 10;
+    [self refreshUI];
 }
 
 
 #pragma mark - CPDFFontSettingViewDelegate
 - (void)CPDFFontSettingView:(CPDFFontSettingView *)view isBold:(BOOL)isBold {
     self.isBold = isBold;
+    [self refreshUI];
 }
 
 - (void)CPDFFontSettingView:(CPDFFontSettingView *)view isItalic:(BOOL)isItalic {
     self.isItalic = isItalic;
+    [self refreshUI];
 }
 
 - (void)CPDFFontSettingView:(CPDFFontSettingView *)view text:(NSString *)text {
@@ -390,6 +394,14 @@
 - (void)fontStyleTableView:(CPDFFontStyleTableView *)fontStyleTableView fontName:(NSString *)fontName {
     self.baseName = fontName;
     self.fontSettingView.fontNameSelectLabel.text = fontName;
+    [self refreshUI];
+}
+
+- (void)refreshUI {
+    NSString * fontName = [self constructionFontname:self.baseName isBold:self.isBold isItalic:self.isItalic];
+    self.comboxChoiceWidget.font = [UIFont fontWithName:fontName size:self.fontSize];
+    CPDFPage *page = self.comboxChoiceWidget.page;
+    [self.annotManage.pdfListView setNeedsDisplayForPage:page];
 }
 
 @end

+ 12 - 2
compdfkit-tools/compdfkit-tools/Form/Controller/CPDFFormRadioButtonViewController.m

@@ -139,8 +139,6 @@
 }
 
 - (void)buttonItemClicked_back:(id)sender {
-    CPDFPage *page = self.buttonWidget.page;
-    [self.annotManage.pdfListView setNeedsDisplayForPage:page];
     [self dismissViewControllerAnimated:YES completion:nil];
 }
 
@@ -181,6 +179,7 @@
 
 - (void)SetCPDFFormTextFiledView:(CPDFFormTextFieldView *)view text:(NSString *)completedText {
     self.buttonWidget.fieldName = completedText;
+    [self refreshUI];
 }
 
 
@@ -198,6 +197,7 @@
     }else if(select == self.colorSelectView) {
         self.buttonWidget.fontColor = color;
     }
+    [self refreshUI];
 }
 
 - (void)selectColorView:(CPDFColorSelectView *)select {
@@ -213,6 +213,7 @@
         self.colorPicker.backgroundColor = [CPDFColorUtils CAnnotationPropertyViewControllerBackgoundColor];
         [self.view addSubview:self.colorPicker];
     }
+    [self refreshUI];
 }
 
 
@@ -230,6 +231,7 @@
     }else if(self.currentSelectColorView == self.colorSelectView) {
         self.buttonWidget.fontColor = color;
     }
+    [self refreshUI];
 }
 
 #pragma mark - UIColorPickerViewControllerDelegate
@@ -246,6 +248,7 @@
     }else if(self.currentSelectColorView == self.colorSelectView) {
         self.buttonWidget.fontColor = viewController.selectedColor;
     }
+    [self refreshUI];
 }
 
 #pragma mark - CPDFFormSwitchViewDelegate
@@ -260,6 +263,13 @@
     }else if(view == self.hideFormSwitchView) {
         [self.buttonWidget setHidden:switcher.on];
     }
+    
+    [self refreshUI];
+}
+
+- (void)refreshUI {
+    CPDFPage *page = self.buttonWidget.page;
+    [self.annotManage.pdfListView setNeedsDisplayForPage:page];
 }
 
 @end