CB-13969 functionality extended to WKWebView
This commit is contained in:
parent
3c0a42e2ae
commit
9c7c2f31d8
@ -73,7 +73,7 @@
|
||||
- (void)navigateTo:(NSURL*)url;
|
||||
- (void)showLocationBar:(BOOL)show;
|
||||
- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition;
|
||||
- (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString;
|
||||
- (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString : (int) buttonIndex;
|
||||
|
||||
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
|
||||
|
||||
|
@ -228,7 +228,8 @@ static CDVWKInAppBrowser* instance = nil;
|
||||
[self.inAppBrowserViewController showLocationBar:browserOptions.location];
|
||||
[self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarposition];
|
||||
if (browserOptions.closebuttoncaption != nil || browserOptions.closebuttoncolor != nil) {
|
||||
[self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption :browserOptions.closebuttoncolor];
|
||||
int closeButtonIndex = browserOptions.lefttoright ? (browserOptions.hidenavigationbuttons ? 1 : 4) : 0;
|
||||
[self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption :browserOptions.closebuttoncolor :closeButtonIndex];
|
||||
}
|
||||
// Set Presentation Style
|
||||
UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
|
||||
@ -884,7 +885,13 @@ BOOL isExiting = FALSE;
|
||||
|
||||
// Filter out Navigation Buttons if user requests so
|
||||
if (_browserOptions.hidenavigationbuttons) {
|
||||
if (_browserOptions.lefttoright) {
|
||||
[self.toolbar setItems:@[flexibleSpaceButton, self.closeButton]];
|
||||
} else {
|
||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];
|
||||
}
|
||||
} else if (_browserOptions.lefttoright) {
|
||||
[self.toolbar setItems:@[self.backButton, fixedSpaceButton, self.forwardButton, flexibleSpaceButton, self.closeButton]];
|
||||
} else {
|
||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
|
||||
}
|
||||
@ -900,7 +907,7 @@ BOOL isExiting = FALSE;
|
||||
[self.webView setFrame:frame];
|
||||
}
|
||||
|
||||
- (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString
|
||||
- (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString : (int) buttonIndex
|
||||
{
|
||||
// the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically
|
||||
// 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 @@ BOOL isExiting = FALSE;
|
||||
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];
|
||||
|
||||
NSMutableArray* items = [self.toolbar.items mutableCopy];
|
||||
[items replaceObjectAtIndex:0 withObject:self.closeButton];
|
||||
[items replaceObjectAtIndex:buttonIndex withObject:self.closeButton];
|
||||
[self.toolbar setItems:items];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user