【发布时间】:2021-02-11 10:25:10
【问题描述】:
知道如何将特定背景颜色应用到底部工具栏吗?
NavigationView {
List {
....
}
.toolbar {
ToolbarItem(placement: .bottomBar) {
Button(action: { model.selectTab(tab: "ITEM1") }, label: { Text("ITEM1") })
}
ToolbarItem(placement: .bottomBar) {
Button(action: { model.selectTab(tab: "ITEM2") }, label: { Text("ITEM2") })
}
ToolbarItem(placement: .bottomBar) {
Button(action: { model.selectTab(tab: "ITEM3") }, label: { Text("ITEM3") })
}
}
}
【问题讨论】:
-
通常你可以做
.background(Color.blue) -
@aheze 不幸的是,如果我将它链接到工具栏,背景颜色不会改变
标签: swift swiftui swiftui-list swiftui-navigationview