CB-13969 functionality extended to WKWebView
This commit is contained in:
parent
3c0a42e2ae
commit
9c7c2f31d8
@ -73,7 +73,7 @@
|
|||||||
- (void)navigateTo:(NSURL*)url;
|
- (void)navigateTo:(NSURL*)url;
|
||||||
- (void)showLocationBar:(BOOL)show;
|
- (void)showLocationBar:(BOOL)show;
|
||||||
- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition;
|
- (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;
|
- (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 showLocationBar:browserOptions.location];
|
||||||
[self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarposition];
|
[self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarposition];
|
||||||
if (browserOptions.closebuttoncaption != nil || browserOptions.closebuttoncolor != nil) {
|
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
|
// Set Presentation Style
|
||||||
UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
|
UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
|
||||||
@ -884,7 +885,13 @@ BOOL isExiting = FALSE;
|
|||||||
|
|
||||||
// Filter out Navigation Buttons if user requests so
|
// Filter out Navigation Buttons if user requests so
|
||||||
if (_browserOptions.hidenavigationbuttons) {
|
if (_browserOptions.hidenavigationbuttons) {
|
||||||
|
if (_browserOptions.lefttoright) {
|
||||||
|
[self.toolbar setItems:@[flexibleSpaceButton, self.closeButton]];
|
||||||
|
} else {
|
||||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];
|
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];
|
||||||
|
}
|
||||||
|
} else if (_browserOptions.lefttoright) {
|
||||||
|
[self.toolbar setItems:@[self.backButton, fixedSpaceButton, self.forwardButton, flexibleSpaceButton, self.closeButton]];
|
||||||
} else {
|
} else {
|
||||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
|
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
|
||||||
}
|
}
|
||||||
@ -900,7 +907,7 @@ BOOL isExiting = FALSE;
|
|||||||
[self.webView setFrame:frame];
|
[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
|
// 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)
|
// 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];
|
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];
|
NSMutableArray* items = [self.toolbar.items mutableCopy];
|
||||||
[items replaceObjectAtIndex:0 withObject:self.closeButton];
|
[items replaceObjectAtIndex:buttonIndex withObject:self.closeButton];
|
||||||
[self.toolbar setItems:items];
|
[self.toolbar setItems:items];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user