【发布时间】:2021-09-30 06:11:08
【问题描述】:
我正在尝试为横向列表标题设置安全区域的背景,但我似乎无法更改默认的深灰色。我可以为行更改它,但不能为标题更改。我不想使用 GroupedListStyle。只想要一个普通列表但要更改安全区域背景:
List {
Section(header:
HStack {
SearchBar()
}
.padding(.horizontal)
.background(Color.white)
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
) {
...
}
}
我尝试使用 .edgesIgnoringSafeArea 设置背景,也尝试使用 ZStack 方法,但深灰色来自实际标题,我无论如何都找不到在横向中覆盖它。
【问题讨论】:
标签: ios xcode swiftui swiftui-list