Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 更改选项卡栏外观_Ios_Swiftui - Fatal编程技术网

Ios 更改选项卡栏外观

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

我正试图用新的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()]
但只有文字颜色发生了变化,字体仍与以前的相同

请尝试以下操作

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()
]