@@ -228,7 +228,8 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
228
228
[self .inAppBrowserViewController showLocationBar: browserOptions.location];
229
229
[self .inAppBrowserViewController showToolBar: browserOptions.toolbar :browserOptions.toolbarposition];
230
230
if (browserOptions.closebuttoncaption != nil || browserOptions.closebuttoncolor != nil ) {
231
- [self .inAppBrowserViewController setCloseButtonTitle: browserOptions.closebuttoncaption :browserOptions.closebuttoncolor];
231
+ int closeButtonIndex = browserOptions.lefttoright ? (browserOptions.hidenavigationbuttons ? 1 : 4 ) : 0 ;
232
+ [self .inAppBrowserViewController setCloseButtonTitle: browserOptions.closebuttoncaption :browserOptions.closebuttoncolor :closeButtonIndex];
232
233
}
233
234
// Set Presentation Style
234
235
UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
@@ -884,9 +885,15 @@ - (void)createViews
884
885
885
886
// Filter out Navigation Buttons if user requests so
886
887
if (_browserOptions.hidenavigationbuttons ) {
887
- [self .toolbar setItems: @[self .closeButton, flexibleSpaceButton]];
888
+ if (_browserOptions.lefttoright ) {
889
+ [self .toolbar setItems: @[flexibleSpaceButton, self .closeButton]];
890
+ } else {
891
+ [self .toolbar setItems: @[self .closeButton, flexibleSpaceButton]];
892
+ }
893
+ } else if (_browserOptions.lefttoright ) {
894
+ [self .toolbar setItems: @[self .backButton, fixedSpaceButton, self .forwardButton, flexibleSpaceButton, self .closeButton]];
888
895
} else {
889
- [self .toolbar setItems: @[self .closeButton, flexibleSpaceButton, self .backButton, fixedSpaceButton, self .forwardButton]];
896
+ [self .toolbar setItems: @[self .closeButton, flexibleSpaceButton, self .backButton, fixedSpaceButton, self .forwardButton]];
890
897
}
891
898
892
899
self.view .backgroundColor = [UIColor grayColor ];
@@ -900,7 +907,7 @@ - (void) setWebViewFrame : (CGRect) frame {
900
907
[self .webView setFrame: frame];
901
908
}
902
909
903
- - (void )setCloseButtonTitle : (NSString *)title : (NSString *) colorString
910
+ - (void )setCloseButtonTitle : (NSString *)title : (NSString *) colorString : ( int ) buttonIndex
904
911
{
905
912
// the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically
906
913
// but, if you want to set this yourself, knock yourself out (we can't set the title for a system Done button, so we have to create a new one)
@@ -912,7 +919,7 @@ - (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString
912
919
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 ];
913
920
914
921
NSMutableArray * items = [self .toolbar.items mutableCopy ];
915
- [items replaceObjectAtIndex: 0 withObject: self .closeButton];
922
+ [items replaceObjectAtIndex: buttonIndex withObject: self .closeButton];
916
923
[self .toolbar setItems: items];
917
924
}
918
925
0 commit comments