我正在尝试使用新的swiftui框架更改tabView外观。我尝试了这个:
appearance.stackedLayoutAppearance.normal.titleTextAttributes = [NSAttributedString.Key.font: UIFont(name: "Lato-Regular", size: 11)!]
appearance.stackedLayoutAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor: Color.TabViewItemNormalColor.uiColor()]
appearance.stackedLayoutAppearance.selected.titleTextAttributes = [NSAttributedString.Key.font: UIFont(name: "Lato-Regular", size: 11)!]
appearance.stackedLayoutAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor: Color.TabViewItemNormalColor.uiColor()]
但是只有文本颜色改变了,字体与以前的一样
答案 0 :(得分:0)
尝试以下
appearance.stackedLayoutAppearance.normal.titleTextAttributes = [
NSAttributedString.Key.font: UIFont(name: "Lato-Regular", size: 11)!,
NSAttributedString.Key.foregroundColor: Color.TabViewItemNormalColor.uiColor()
]
appearance.stackedLayoutAppearance.selected.titleTextAttributes = [
NSAttributedString.Key.font: UIFont(name: "Lato-Regular", size: 11)!,
NSAttributedString.Key.foregroundColor: Color.TabViewItemNormalColor.uiColor()
]