SwiftUI - Remove space between cells

后端 未结 1 687
甜味超标
甜味超标 2021-02-08 06:49

I am implementing a list view in SwiftUI. What I am trying to approach is to have cells that has no space between any other cells or parent view.

So in this scr

1条回答
  •  -上瘾入骨i
    2021-02-08 07:10

    I've had good luck with listRowInsets

    struct ContentView: View {
        var body: some View {
            List {
                Color.red
                .listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
                Color.blue
                .listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
                Color.yellow
                .listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
            }
        }
    }
    

    0 讨论(0)
提交回复
热议问题