Skip to content
Permalink
Browse files
Merge pull request #260 from bentleyo/navigation-buttons
Fix nav buttons on iOS and allow custom color
  • Loading branch information
stevengill committed Apr 12, 2018
2 parents 3f0528c + 65a825a commit 013a861493a51821a79b16cd3c396458edf659fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
@@ -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.
@@ -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;

@@ -642,19 +642,24 @@ - (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) {
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];
} 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];

0 comments on commit 013a861

Please sign in to comment.