【发布时间】:2021-07-28 21:45:34
【问题描述】:
我一直在尝试使用 GroupedListStyle() 来减少列表中各部分之间的空间,但没有任何运气。
上面截图的代码:
struct ContentView: View {
var body: some View {
List {
Section {
Text("Hello, World!")
Text("Hello, World!")
Text("Hello, World!")
}
Section {
Text("Hello, World!")
}
Section {
Text("Hello, World!")
Text("Hello, World!")
}
}.listStyle(GroupedListStyle())
}
}
任何建议将不胜感激。
【问题讨论】:
-
这是默认布局。但Reduce Form spacing between sections SwiftUI 提供了可能的解决方案。
-
我也有同样的问题。你找到解决办法了吗?