Anj*_*iya 5 tabbar ios swiftui
我正在尝试更改TabBar中选定选项卡的颜色,但是没有任何效果。我可以backgroundColor通过编写 来更改TabBar
struct ContentView: View {
init() {
UITabBar.appearance().backgroundColor = UIColor.purple
}
var body: some View {
}
}
Run Code Online (Sandbox Code Playgroud)
迅速设置tintColor并确实更改了所选标签的颜色。但是,对于swiftUI,我需要做什么?
这是我的代码,
TabView(selection: $selection) {
AView()
.tabItem {
VStack {
Image(systemName: "bubble.left.and.bubble.right")
Text("A Tab")
}
}.tag(0)
BView()
.tabItem {
VStack {
Image(systemName: "house")
Text("B Tab")
}
}.tag(1)
CView()
.tabItem {
VStack {
Image(systemName: "circle.grid.3x3")
Text("C Tab")
}
}.tag(2)
}
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?提前致谢!!
使用accentColor:https : //developer.apple.com/documentation/swiftui/tabview/3368073-accentcolor
TabView {
// fill this out with your tabbed content
}
.accentColor(.orange)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
666 次 |
| 最近记录: |