Add customisation of the navigation buttons for iOS

This commit is contained in:
Bentley O'Kane-Chase 2018-03-21 21:50:25 +10:00
parent a3fca87ee5
commit 65a825a193
3 changed files with 8 additions and 0 deletions

View File

@ -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.

View File

@ -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;

View File

@ -642,11 +642,17 @@
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) {