@@ -228,7 +228,8 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
228228 [self .inAppBrowserViewController showLocationBar: browserOptions.location];
229229 [self .inAppBrowserViewController showToolBar: browserOptions.toolbar :browserOptions.toolbarposition];
230230 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];
232233 }
233234 // Set Presentation Style
234235 UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
@@ -884,9 +885,15 @@ - (void)createViews
884885
885886 // Filter out Navigation Buttons if user requests so
886887 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]];
888895 } 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]];
890897 }
891898
892899 self.view .backgroundColor = [UIColor grayColor ];
@@ -900,7 +907,7 @@ - (void) setWebViewFrame : (CGRect) frame {
900907 [self .webView setFrame: frame];
901908}
902909
903- - (void )setCloseButtonTitle : (NSString *)title : (NSString *) colorString
910+ - (void )setCloseButtonTitle : (NSString *)title : (NSString *) colorString : ( int ) buttonIndex
904911{
905912 // the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically
906913 // 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
912919 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 ];
913920
914921 NSMutableArray * items = [self .toolbar.items mutableCopy ];
915- [items replaceObjectAtIndex: 0 withObject: self .closeButton];
922+ [items replaceObjectAtIndex: buttonIndex withObject: self .closeButton];
916923 [self .toolbar setItems: items];
917924}
918925
0 commit comments