如何在 SwiftUI 中删除列表的左右填充? [英] How to remove the left and right Padding of a List in SwiftUI?
本文介绍了如何在 SwiftUI 中删除列表的左右填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 SwiftUI 中删除列表的左右填充?我创建的每个列表都有一个单元格的前导和尾随边框.
How to remove the left and right Padding of a List in SwiftUI? Every List i create has borders to the leading and trailing of a cell.
我应该添加什么修饰符来删除它?
What modifier should I add to remove this?
推荐答案
看起来 .listRowInsets
对 List
中的行不起作用代码>内容代码>.
It looks like .listRowInsets
doesn't work for rows in a List
that is initialised with content
.
所以这不起作用:
List(items) { item in
ItemRow(item: item)
.listRowInsets(EdgeInsets())
}
但这确实是:
List {
ForEach(items) { item in
ItemRow(item: item)
.listRowInsets(EdgeInsets())
}
}
这篇关于如何在 SwiftUI 中删除列表的左右填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文