Skip to content

Commit

Permalink
[Tabs] Fixes layout for changing font sizes. (#7771)
Browse files Browse the repository at this point in the history
When different font sizes for different states are used, the item view may end up with a different layout or even a different intrinsic content size.

Follow-up to #7757
  • Loading branch information
Robert Moore committed Jul 2, 2019
1 parent 2674c8c commit 4842c32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Expand Up @@ -126,6 +126,7 @@ - (void)viewDidLoad {
forState:UIControlStateSelected];
[self.tabBar setTitleFont:self.containerScheme.typographyScheme.button
forState:UIControlStateNormal];
[self.tabBar setTitleFont:[UIFont systemFontOfSize:16] forState:UIControlStateSelected];
self.tabBar.selectedItem = item4;
self.tabBar.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.tabBar];
Expand Down
2 changes: 2 additions & 0 deletions components/Tabs/src/TabBarView/MDCTabBarView.m
Expand Up @@ -305,6 +305,8 @@ - (void)updateTitleFontForAllViews {
} else {
tabBarViewItemView.titleLabel.font = [self titleFontForState:UIControlStateNormal];
}
[itemView invalidateIntrinsicContentSize];
[itemView setNeedsLayout];
}
}

Expand Down

0 comments on commit 4842c32

Please sign in to comment.