From 5f6202f3fc72384193805fc902280843e5699182 Mon Sep 17 00:00:00 2001 From: Joao Lourenco Date: Thu, 12 Jan 2023 12:41:43 +0000 Subject: [PATCH] Set custom font size --- src/android/InAppBrowser.java | 2 +- src/ios/CDVWKInAppBrowser.m | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 76dc150..a096562 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -740,7 +740,7 @@ public class InAppBrowser extends CordovaPlugin { // Use TextView for text TextView close = new TextView(cordova.getActivity()); close.setText(closeButtonCaption); - close.setTextSize(20); + close.setTextSize(14); if (closeButtonColor != "") close.setTextColor(android.graphics.Color.parseColor(closeButtonColor)); close.setGravity(android.view.Gravity.CENTER_VERTICAL); close.setPadding(this.dpToPixels(10), 0, this.dpToPixels(10), 0); diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 2adcf0c..ad5c6a6 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -936,6 +936,11 @@ BOOL isExiting = FALSE; // If color on closebutton is requested then initialize with that that color, otherwise use initialize with default self.closeButton.tintColor = colorString != nil ? [self colorFromHexString:colorString] : [UIColor colorWithRed:60.0 / 255.0 green:136.0 / 255.0 blue:230.0 / 255.0 alpha:1]; + NSUInteger fontSize = 14; + UIFont *font = [UIFont systemFontOfSize:fontSize]; + NSDictionary *attributes = @{NSFontAttributeName: font}; + [self.closeButton setTitleTextAttributes:attributes forState:UIControlStateNormal]; + NSMutableArray* items = [self.toolbar.items mutableCopy]; [items replaceObjectAtIndex:buttonIndex withObject:self.closeButton]; [self.toolbar setItems:items];