Commit a81a6a11 authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Fix layout for UIToolBar items in the shell app.

Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I5a0254977d3bcfeb6256adaab7d4b8dbb8bace04
Reviewed-on: https://chromium-review.googlesource.com/965262Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: Hiroshi Ichikawa <ichikawa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543582}
parent 970b653d
......@@ -27,10 +27,10 @@ NSString* const kWebViewShellJavaScriptDialogTextFieldAccessibiltyIdentifier =
@property(nonatomic, strong) UIView* containerView;
// Text field used for navigating to URLs.
@property(nonatomic, strong) UITextField* field;
// Toolbar button to navigate backwards.
@property(nonatomic, strong) UIBarButtonItem* backButton;
// Toolbar button to navigate forwards.
@property(nonatomic, strong) UIBarButtonItem* forwardButton;
// Button to navigate backwards.
@property(nonatomic, strong) UIButton* backButton;
// Button to navigate forwards.
@property(nonatomic, strong) UIButton* forwardButton;
// Toolbar containing navigation buttons and |field|.
@property(nonatomic, strong) UIToolbar* toolbar;
// Handles the autofill of the content displayed in |webView|.
......@@ -103,35 +103,46 @@ NSString* const kWebViewShellJavaScriptDialogTextFieldAccessibiltyIdentifier =
[_field setAccessibilityLabel:kWebViewShellAddressFieldAccessibilityLabel];
// Set up the toolbar buttons.
self.backButton = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"toolbar_back"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(back)];
self.backButton = [[UIButton alloc] init];
[_backButton setImage:[UIImage imageNamed:@"toolbar_back"]
forState:UIControlStateNormal];
[_backButton addTarget:self
action:@selector(back)
forControlEvents:UIControlEventTouchUpInside];
[_backButton setAccessibilityLabel:kWebViewShellBackButtonAccessibilityLabel];
self.forwardButton = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"toolbar_forward"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(forward)];
[_backButton.widthAnchor constraintEqualToConstant:44].active = YES;
self.forwardButton = [[UIButton alloc] init];
[_forwardButton setImage:[UIImage imageNamed:@"toolbar_forward"]
forState:UIControlStateNormal];
[_forwardButton addTarget:self
action:@selector(forward)
forControlEvents:UIControlEventTouchUpInside];
[_forwardButton
setAccessibilityLabel:kWebViewShellForwardButtonAccessibilityLabel];
UIBarButtonItem* stop = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"toolbar_stop"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(stopLoading)];
UIBarButtonItem* menu = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"toolbar_more_horiz"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(showMenu)];
[_forwardButton.widthAnchor constraintEqualToConstant:44].active = YES;
UIButton* stopButton = [[UIButton alloc] init];
[stopButton setImage:[UIImage imageNamed:@"toolbar_stop"]
forState:UIControlStateNormal];
[stopButton addTarget:self
action:@selector(stopLoading)
forControlEvents:UIControlEventTouchUpInside];
[stopButton.widthAnchor constraintEqualToConstant:44].active = YES;
UIButton* menuButton = [[UIButton alloc] init];
[menuButton setImage:[UIImage imageNamed:@"toolbar_more_horiz"]
forState:UIControlStateNormal];
[menuButton addTarget:self
action:@selector(showMenu)
forControlEvents:UIControlEventTouchUpInside];
[menuButton.widthAnchor constraintEqualToConstant:44].active = YES;
[_toolbar setItems:@[
_backButton, _forwardButton, stop, menu,
[[UIBarButtonItem alloc] initWithCustomView:_backButton],
[[UIBarButtonItem alloc] initWithCustomView:_forwardButton],
[[UIBarButtonItem alloc] initWithCustomView:stopButton],
[[UIBarButtonItem alloc] initWithCustomView:menuButton],
[[UIBarButtonItem alloc] initWithCustomView:_field]
]];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment