Merge pull request #262 from landsbankinn/CB-13969
Cb 13969 - Allow close button and navigation buttons positions to be swapped
This commit is contained in:
commit
d01bd25a88
@ -123,6 +123,7 @@ instance, or the system browser.
|
|||||||
- __hideurlbar__: set to `yes` to hide the url bar on the location toolbar, only has effect if user has location set to `yes`. The default value is `no`.
|
- __hideurlbar__: set to `yes` to hide the url bar on the location toolbar, only has effect if user has location set to `yes`. The default value is `no`.
|
||||||
- __navigationbuttoncolor__: set to a valid hex color string, for example: `#00ff00`, and it will change the color of both navigation buttons from default. Only has effect if user has location set to `yes` and not hidenavigationbuttons set to `yes`.
|
- __navigationbuttoncolor__: set to a valid hex color string, for example: `#00ff00`, and it will change the color of both navigation buttons from default. Only has effect if user has location set to `yes` and not hidenavigationbuttons set to `yes`.
|
||||||
- __toolbarcolor__: set to a valid hex color string, for example: `#00ff00`, and it will change the color the toolbar from default. Only has effect if user has location set to `yes`.
|
- __toolbarcolor__: set to a valid hex color string, for example: `#00ff00`, and it will change the color the toolbar from default. Only has effect if user has location set to `yes`.
|
||||||
|
- __lefttoright__: Set to `yes` to swap positions of the navigation buttons and the close button. Specifically, navigation buttons go to the left and close button to the right.
|
||||||
- __zoom__: set to `yes` to show Android browser's zoom controls, set to `no` to hide them. Default value is `yes`.
|
- __zoom__: set to `yes` to show Android browser's zoom controls, set to `no` to hide them. Default value is `yes`.
|
||||||
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`).
|
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`).
|
||||||
- __shouldPauseOnSuspend__: Set to `yes` to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues like described in [CB-11013](https://issues.apache.org/jira/browse/CB-11013)).
|
- __shouldPauseOnSuspend__: Set to `yes` to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues like described in [CB-11013](https://issues.apache.org/jira/browse/CB-11013)).
|
||||||
@ -144,6 +145,7 @@ instance, or the system browser.
|
|||||||
- __toolbar__: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`)
|
- __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.
|
- __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.
|
- __toolbartranslucent__: set to `yes` or `no` to make the toolbar translucent(semi-transparent) (defaults to `yes`). Only applicable if toolbar is not disabled.
|
||||||
|
- __lefttoright__: Set to `yes` to swap positions of the navigation buttons and the close button. Specifically, close button goes to the right and navigation buttons to the left.
|
||||||
- __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). Only applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`) on iOS 10+.
|
- __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). Only applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`) on iOS 10+.
|
||||||
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`). Applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`).
|
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`). Applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`).
|
||||||
- __allowInlineMediaPlayback__: Set to `yes` or `no` to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`). Applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`).
|
- __allowInlineMediaPlayback__: Set to `yes` or `no` to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`). Applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`).
|
||||||
|
@ -110,6 +110,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
private static final String TOOLBAR_COLOR = "toolbarcolor";
|
private static final String TOOLBAR_COLOR = "toolbarcolor";
|
||||||
private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption";
|
private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption";
|
||||||
private static final String CLOSE_BUTTON_COLOR = "closebuttoncolor";
|
private static final String CLOSE_BUTTON_COLOR = "closebuttoncolor";
|
||||||
|
private static final String LEFT_TO_RIGHT = "lefttoright";
|
||||||
private static final String HIDE_NAVIGATION = "hidenavigationbuttons";
|
private static final String HIDE_NAVIGATION = "hidenavigationbuttons";
|
||||||
private static final String NAVIGATION_COLOR = "navigationbuttoncolor";
|
private static final String NAVIGATION_COLOR = "navigationbuttoncolor";
|
||||||
private static final String HIDE_URL = "hideurlbar";
|
private static final String HIDE_URL = "hideurlbar";
|
||||||
@ -138,6 +139,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
private final static int FILECHOOSER_REQUESTCODE_LOLLIPOP = 2;
|
private final static int FILECHOOSER_REQUESTCODE_LOLLIPOP = 2;
|
||||||
private String closeButtonCaption = "";
|
private String closeButtonCaption = "";
|
||||||
private String closeButtonColor = "";
|
private String closeButtonColor = "";
|
||||||
|
private boolean leftToRight = false;
|
||||||
private int toolbarColor = android.graphics.Color.LTGRAY;
|
private int toolbarColor = android.graphics.Color.LTGRAY;
|
||||||
private boolean hideNavigationButtons = false;
|
private boolean hideNavigationButtons = false;
|
||||||
private String navigationButtonColor = "";
|
private String navigationButtonColor = "";
|
||||||
@ -679,6 +681,10 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
if (closeButtonColorSet != null) {
|
if (closeButtonColorSet != null) {
|
||||||
closeButtonColor = closeButtonColorSet;
|
closeButtonColor = closeButtonColorSet;
|
||||||
}
|
}
|
||||||
|
String leftToRightSet = features.get(LEFT_TO_RIGHT);
|
||||||
|
if (leftToRightSet != null) {
|
||||||
|
leftToRight = leftToRightSet.equals("yes") ? true : false;
|
||||||
|
}
|
||||||
String toolbarColorSet = features.get(TOOLBAR_COLOR);
|
String toolbarColorSet = features.get(TOOLBAR_COLOR);
|
||||||
if (toolbarColorSet != null) {
|
if (toolbarColorSet != null) {
|
||||||
toolbarColor = android.graphics.Color.parseColor(toolbarColorSet);
|
toolbarColor = android.graphics.Color.parseColor(toolbarColorSet);
|
||||||
@ -746,7 +752,8 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
||||||
closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
if (leftToRight) closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
||||||
|
else closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||||
_close.setLayoutParams(closeLayoutParams);
|
_close.setLayoutParams(closeLayoutParams);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 16)
|
if (Build.VERSION.SDK_INT >= 16)
|
||||||
@ -777,6 +784,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
||||||
dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
|
dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
|
||||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
dialog.setInAppBroswer(getInAppBrowser());
|
dialog.setInAppBroswer(getInAppBrowser());
|
||||||
|
|
||||||
@ -790,15 +798,22 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
toolbar.setBackgroundColor(toolbarColor);
|
toolbar.setBackgroundColor(toolbarColor);
|
||||||
toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44)));
|
toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44)));
|
||||||
toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2));
|
toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2));
|
||||||
toolbar.setHorizontalGravity(Gravity.LEFT);
|
if (leftToRight) {
|
||||||
|
toolbar.setHorizontalGravity(Gravity.LEFT);
|
||||||
|
} else {
|
||||||
|
toolbar.setHorizontalGravity(Gravity.RIGHT);
|
||||||
|
}
|
||||||
toolbar.setVerticalGravity(Gravity.TOP);
|
toolbar.setVerticalGravity(Gravity.TOP);
|
||||||
|
|
||||||
// Action Button Container layout
|
// Action Button Container layout
|
||||||
RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity());
|
RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity());
|
||||||
actionButtonContainer.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
|
RelativeLayout.LayoutParams actionButtonLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||||
|
if (leftToRight) actionButtonLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||||
|
else actionButtonLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
||||||
|
actionButtonContainer.setLayoutParams(actionButtonLayoutParams);
|
||||||
actionButtonContainer.setHorizontalGravity(Gravity.LEFT);
|
actionButtonContainer.setHorizontalGravity(Gravity.LEFT);
|
||||||
actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL);
|
actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL);
|
||||||
actionButtonContainer.setId(Integer.valueOf(1));
|
actionButtonContainer.setId(leftToRight ? Integer.valueOf(5) : Integer.valueOf(1));
|
||||||
|
|
||||||
// Back button
|
// Back button
|
||||||
ImageButton back = new ImageButton(cordova.getActivity());
|
ImageButton back = new ImageButton(cordova.getActivity());
|
||||||
@ -878,7 +893,8 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
|
|
||||||
|
|
||||||
// Header Close/Done button
|
// Header Close/Done button
|
||||||
View close = createCloseButton(5);
|
int closeButtonId = leftToRight ? 1 : 5;
|
||||||
|
View close = createCloseButton(closeButtonId);
|
||||||
toolbar.addView(close);
|
toolbar.addView(close);
|
||||||
|
|
||||||
// Footer
|
// Footer
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
@property (nonatomic, assign) BOOL toolbar;
|
@property (nonatomic, assign) BOOL toolbar;
|
||||||
@property (nonatomic, copy) NSString* closebuttoncaption;
|
@property (nonatomic, copy) NSString* closebuttoncaption;
|
||||||
@property (nonatomic, copy) NSString* closebuttoncolor;
|
@property (nonatomic, copy) NSString* closebuttoncolor;
|
||||||
|
@property (nonatomic, assign) BOOL lefttoright;
|
||||||
@property (nonatomic, copy) NSString* toolbarposition;
|
@property (nonatomic, copy) NSString* toolbarposition;
|
||||||
@property (nonatomic, copy) NSString* toolbarcolor;
|
@property (nonatomic, copy) NSString* toolbarcolor;
|
||||||
@property (nonatomic, assign) BOOL toolbartranslucent;
|
@property (nonatomic, assign) BOOL toolbartranslucent;
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
self.disallowoverscroll = NO;
|
self.disallowoverscroll = NO;
|
||||||
self.hidenavigationbuttons = NO;
|
self.hidenavigationbuttons = NO;
|
||||||
self.closebuttoncolor = nil;
|
self.closebuttoncolor = nil;
|
||||||
|
self.lefttoright = false;
|
||||||
self.toolbarcolor = nil;
|
self.toolbarcolor = nil;
|
||||||
self.toolbartranslucent = YES;
|
self.toolbartranslucent = YES;
|
||||||
self.beforeload = @"";
|
self.beforeload = @"";
|
||||||
|
@ -84,7 +84,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;
|
||||||
|
|
||||||
|
@ -172,7 +172,8 @@ static CDVUIInAppBrowser* 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
|
||||||
@ -763,9 +764,15 @@ static CDVUIInAppBrowser* instance = nil;
|
|||||||
|
|
||||||
// Filter out Navigation Buttons if user requests so
|
// Filter out Navigation Buttons if user requests so
|
||||||
if (_browserOptions.hidenavigationbuttons) {
|
if (_browserOptions.hidenavigationbuttons) {
|
||||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];
|
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 {
|
} else {
|
||||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
|
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.view.backgroundColor = [UIColor grayColor];
|
self.view.backgroundColor = [UIColor grayColor];
|
||||||
@ -779,7 +786,7 @@ static CDVUIInAppBrowser* instance = nil;
|
|||||||
[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)
|
||||||
@ -791,7 +798,7 @@ static CDVUIInAppBrowser* instance = nil;
|
|||||||
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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,9 +885,15 @@ 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) {
|
||||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];
|
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 {
|
} else {
|
||||||
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
|
[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.view.backgroundColor = [UIColor grayColor];
|
self.view.backgroundColor = [UIColor grayColor];
|
||||||
@ -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