Chromium Code Reviews| Index: ios/clean/chrome/browser/ui/toolbar/toolbar_button.mm |
| diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_button.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_button.mm |
| index a96deea2f2b41e922ee4bcffe0bc3af5ca94b085..c661b282c02b86229381e91aa3b19619654ef5f8 100644 |
| --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_button.mm |
| +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_button.mm |
| @@ -20,10 +20,25 @@ |
| [button setImage:normalImage forState:UIControlStateNormal]; |
| [button setImage:highlightedImage forState:UIControlStateHighlighted]; |
| [button setImage:disabledImage forState:UIControlStateDisabled]; |
| + button.titleLabel.textAlignment = NSTextAlignmentCenter; |
| + [[button titleLabel] setFont:[UIFont systemFontOfSize:11]]; |
|
edchin
2017/05/27 16:25:06
Is there some predefined font size that can be use
marq (ping after 24h)
2017/05/29 11:04:36
We should either duplicate/refactor the logic in
sczs
2017/05/30 00:18:20
Moved this to the VC. Because of the UI constraint
|
| button.translatesAutoresizingMaskIntoConstraints = NO; |
| return button; |
| } |
| +- (void)layoutSubviews { |
| + [super layoutSubviews]; |
| + // If the UIButton title has text it will center it on top of the image, |
| + // this is currently used for the TabStripButton which displays the |
| + // total number of tabs. |
| + if (self.titleLabel.text) { |
| + CGSize size = self.bounds.size; |
| + CGPoint center = CGPointMake(size.width / 2, size.height / 2); |
| + self.imageView.center = center; |
|
marq (ping after 24h)
2017/05/29 11:04:36
Looks like this is an exact copy of the ToolbarCen
sczs
2017/05/30 00:18:20
Great catch. I missed it somehow.
|
| + self.titleLabel.frame = self.bounds; |
| + } |
| +} |
| + |
| #pragma mark - Public Methods |
| - (void)updateHiddenInCurrentSizeClass { |