【发布时间】:2021-10-07 06:43:19
【问题描述】:
我们正在为列表部分的标题使用 SwiftUI 和自定义视图。
但是当使用 Xcode13/iOS15 SDK 编译时,似乎在标题容器视图中固定了额外的左/右 20px + 上/下 6px 填充。我什至创建了最低限度的测试应用程序,它似乎无法自定义。
这与新引入的sectionHeaderTopPadding 无关,因此将其设置为 0 对我不起作用。我还从this post 尝试了.environment(\.defaultMinListHeaderHeight, 16),它也不会改变填充。
这里是sn-p和截图:
List {
Section(header:
Text("Big header")
.foregroundColor(.red)
.background(Color.gray)
.frame(height: 30)
.padding(0)
) {
Text("Hello, world! 1")
.padding()
Text("Hello, world! 2")
.padding()
Text("Hello, world! 3")
.padding()
}
}
.environment(\.defaultMinListHeaderHeight, 1)
.listStyle(PlainListStyle())
非常感谢您的帮助 :) 干杯
【问题讨论】:
标签: swiftui swiftui-list ios15 xcode13