Ios 更改选项卡栏外观
我正试图用新的swiftui框架改变tabView的外观。我试过这个:Ios 更改选项卡栏外观,ios,swiftui,Ios,Swiftui,我正试图用新的swiftui框架改变tabView的外观。我试过这个: appearance.stackedLayoutAppearance.normal.titleTextAttributes = [NSAttributedString.Key.font: UIFont(name: "Lato-Regular", size: 11)!] appearance.stackedLayoutAppearance.normal.titleTextAttributes = [NSAttributedSt
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()]
但只有文字颜色发生了变化,字体仍与以前的相同请尝试以下操作
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()
]