MDCTabBar更改字体类型和大小

时间:2017-07-18 15:29:39

标签: ios swift material-design uitabbaritem material-components

是否可以将标签的字体大小更改为MDCTabBar?

MDCTabBar是谷歌库中使用iOS设计素材的一部分

https://github.com/material-components/material-components-ios

1 个答案:

答案 0 :(得分:-1)

CGFloat width = [UIScreen mainScreen].bounds.size.width;
UIFont *font = [MDCTypography buttonFont];
if (width <= 320.0) {
    font = [UIFont fontWithName:@"Dosis-Medium" size:12];
} else if (width <= 375.0) {
    font = [UIFont fontWithName:@"Dosis-Medium" size:14];
} else {
    font = [UIFont fontWithName:@"Dosis-Medium" size:15];
}
self.tabBar.unselectedItemTitleFont = font;
self.tabBar.selectedItemTitleFont = font;