Commit aab96631 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Fix TabGrid toolbar button constraints

This CL removes the autolayout constraints on the TabGrid button in the
toolbar and instead positions it using frames.

Bug: 862576
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I5eda2cc58ee38228e40870f723315bc91ac6953f
Reviewed-on: https://chromium-review.googlesource.com/1133167Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574153}
parent 141c98bb
......@@ -66,16 +66,11 @@ const CGFloat kLabelMargin = 7;
- (UILabel*)tabCountLabel {
if (!_tabCountLabel) {
_tabCountLabel = [[UILabel alloc] init];
_tabCountLabel.translatesAutoresizingMaskIntoConstraints = NO;
[_tabCountLabel setContentHuggingPriority:UILayoutPriorityDefaultLow
forAxis:UILayoutConstraintAxisHorizontal];
[self addSubview:_tabCountLabel];
AddSameConstraintsToSidesWithInsets(
_tabCountLabel, self.imageView,
LayoutSides::kTop | LayoutSides::kBottom | LayoutSides::kLeading |
LayoutSides::kTrailing,
ChromeDirectionalEdgeInsetsMake(kLabelMargin, kLabelMargin,
kLabelMargin, kLabelMargin));
CGRect imageFrame = self.imageView.frame;
_tabCountLabel.frame = CGRectInset(imageFrame, kLabelMargin, kLabelMargin);
_tabCountLabel.font = [UIFont systemFontOfSize:kTabGridButtonFontSize
weight:UIFontWeightBold];
_tabCountLabel.adjustsFontSizeToFitWidth = YES;
......@@ -87,4 +82,14 @@ const CGFloat kLabelMargin = 7;
return _tabCountLabel;
}
- (void)layoutSubviews {
[super layoutSubviews];
if (!_tabCountLabel)
return;
CGRect imageFrame = self.imageView.frame;
self.tabCountLabel.frame =
CGRectInset(imageFrame, kLabelMargin, kLabelMargin);
}
@end
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