【发布时间】:2022-12-20 19:49:19
【问题描述】:
我尝试使用 UITabBar.appearance().unselectedItemTintColor 更改图标的颜色,但它仅适用于 systemImage 并且不突出显示图像,仅突出显示文本。
init() {
UITabBar.appearance().unselectedItemTintColor = .secondaryLabel
}
TabView {
FirstView()
.tabItem {
Text("Home")
Image("home")
}
CatalogView()
.tabItem {
Text("Categories")
Image("catalog")
}
CustomerProfileView()
.tabItem {
Text("Profile")
Image("profile")
}
ShoppingView()
.tabItem {
Text("Cart")
Image("shoppingbasket")
}
}
我也试过 .accentColor 但 Xcode 说它将被弃用。
【问题讨论】:
-
this 是否回答了您的问题?
-
@Yrb 嗨!我尝试了 UITabBar.appearance().tintColor 和 UITabBar.appearance().barTintColor 但它没有突出显示图标
标签: swiftui uitabbarcontroller