【发布时间】:2021-05-08 20:23:39
【问题描述】:
尝试 tabItem 选项并遇到问题....我在分隔选项卡视图上的元素时遇到了一些问题。在第一个元素之前的左侧有一个超长的缩进。(见图)我遇到了一个解决方案,但我不确定将它放在哪里,或者在 SwiftUI 中是否有更好的东西:(tabBar.itemPositioning = .填)
我们将不胜感激。 谢谢
==============
struct ContentView: View {
@State var selected = 0
var body: some View {
TabView (selection: $selected){
mainscreen()
DayEntry().tabItem ({
Image(systemName: "calendar.circle")
Text("Home")
}).tag(0)
mainscreen()
.tabItem ({
Image(systemName: "quote.bubble")
Text("Quote")
}).tag(1)
DayEntryVStacks()
.tabItem ({
Image(systemName: "gear")
Text("Settings")
}).tag(2)
DayEntryVStacks()
.tabItem ({
Image(systemName: "calendar.badge.plus")
Text("Month")
}).tag(3)
} .accentColor(.red)
// tabBar.itemPositioning = .fill
}
}
【问题讨论】: