Я хочу изменить цвет невыбранных элементов/элементов по умолчанию в TabView. Он отлично работает для выбранной вкладки и текста невыбранного элемента, но не меняет цвет значка невыбранного элемента. Как вы можете видеть на следующем снимке экрана, цвет значка черный. Как мне изменить его на синий?
import SwiftUI
@main
struct TestApp: App {
init() {
UITabBar.appearance().unselectedItemTintColor = UIColor.systemBlue
let appearance = UITabBarAppearance()
appearance.configureWithDefaultBackground()
//unselected (normal) state: icon + text
appearance.stackedLayoutAppearance.normal.iconColor = .systemBlue. //does not work
appearance.stackedLayoutAppearance.normal.titleTextAttributes = [ //works
.foregroundColor: UIColor.systemBlue
]
UITabBar.appearance().standardAppearance = appearance
}
var body: some Scene {
WindowGroup {
TabView {
SettingsView()
.tabItem {
Label("Received", systemImage: "tray.and.arrow.down")
.symbolRenderingMode(.monochrome)
}
.tag(0)
SettingsView()
.tabItem {
Label("Sent", systemImage: "tray.and.arrow.up")
.symbolRenderingMode(.monochrome)
}
SettingsView()
.tabItem {
Label("Account", systemImage: "person.crop.circle")
.symbolRenderingMode(.monochrome)
}
}
.tint(.red)
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... bview-item