stevengill closed pull request #260: Fix nav buttons on iOS and allow custom 
color
URL: https://github.com/apache/cordova-plugin-inappbrowser/pull/260
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/README.md b/README.md
index 936f1dce5..3f3967b50 100644
--- a/README.md
+++ b/README.md
@@ -138,6 +138,7 @@ instance, or the system browser.
     - __closebuttoncaption__: set to a string to use as the __Done__ button's 
caption. Note that you need to localize this value yourself.
     - __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns 
on/off the UIWebViewBounce property.
     - __hidenavigationbuttons__:  set to `yes` or `no` to turn the toolbar 
navigation buttons on or off (defaults to `no`). Only applicable if toolbar is 
not disabled.
+    - __navigationbuttoncolor__:  set as a valid hex color string, for 
example: `#00ff00`, to change from the default color. Only applicable if 
navigation buttons are visible.
     - __toolbar__:  set to `yes` or `no` to turn the toolbar on or off for the 
InAppBrowser (defaults to `yes`)
     - __toolbarcolor__: set as a valid hex color string, for example: 
`#00ff00`, to change from the default color of the toolbar. Only applicable if 
toolbar is not disabled.
     - __toolbartranslucent__:  set to `yes` or `no` to make the toolbar 
translucent(semi-transparent)  (defaults to `yes`). Only applicable if toolbar 
is not disabled.
diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h
index 9338c559b..cb36d349e 100644
--- a/src/ios/CDVInAppBrowser.h
+++ b/src/ios/CDVInAppBrowser.h
@@ -54,6 +54,7 @@
 @property (nonatomic, copy) NSString* toolbarcolor;
 @property (nonatomic, assign) BOOL toolbartranslucent;
 @property (nonatomic, assign) BOOL hidenavigationbuttons;
+@property (nonatomic, copy) NSString* navigationbuttoncolor;
 @property (nonatomic, assign) BOOL clearcache;
 @property (nonatomic, assign) BOOL clearsessioncache;
 
diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m
index a581472dd..8847b442c 100644
--- a/src/ios/CDVInAppBrowser.m
+++ b/src/ios/CDVInAppBrowser.m
@@ -642,11 +642,17 @@ - (void)createViews
     self.forwardButton = [[UIBarButtonItem alloc] 
initWithTitle:frontArrowString style:UIBarButtonItemStylePlain target:self 
action:@selector(goForward:)];
     self.forwardButton.enabled = YES;
     self.forwardButton.imageInsets = UIEdgeInsetsZero;
+    if (_browserOptions.navigationbuttoncolor != nil) { // Set button color if 
user sets it in options
+      self.forwardButton.tintColor = [self 
colorFromHexString:_browserOptions.navigationbuttoncolor];
+    }
 
     NSString* backArrowString = NSLocalizedString(@"◄", nil); // create arrow 
from Unicode char
     self.backButton = [[UIBarButtonItem alloc] initWithTitle:backArrowString 
style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)];
     self.backButton.enabled = YES;
     self.backButton.imageInsets = UIEdgeInsetsZero;
+    if (_browserOptions.navigationbuttoncolor != nil) { // Set button color if 
user sets it in options
+      self.backButton.tintColor = [self 
colorFromHexString:_browserOptions.navigationbuttoncolor];
+    }
 
     // Filter out Navigation Buttons if user requests so
     if (_browserOptions.hidenavigationbuttons) {
@@ -654,7 +660,6 @@ - (void)createViews
     } else {
       [self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, 
self.backButton, fixedSpaceButton, self.forwardButton]];
     }
-    [self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];
 
     self.view.backgroundColor = [UIColor grayColor];
     [self.view addSubview:self.toolbar];


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to