如何在iOS 14中的SwiftUI 2.0中删除列表分隔符行 [英] How to remove List Separator lines in SwiftUI 2.0 in iOS 14

查看:543
本文介绍了如何在iOS 14中的SwiftUI 2.0中删除列表分隔符行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以问题很简单,就在标题中.我想在SwiftUI iOS 14中删除行分隔符.以前,我使用的是 UITableView().appearance().separatorStyle = .none 过去曾在iOS 13中完成过这项工作.现在,它不起作用.有关如何使其工作的任何更新或想法.谢谢:)

So the question is pretty simple and it's in the title. I want to remove the line separator in SwiftUI iOS 14. Previously, I was using UITableView().appearance().separatorStyle = .none and that used to do the job in iOS 13. Now however, it doesn't work. Any update or idea on how to make it work. Thanks:)

推荐答案

此处是可能解决方案的演示.经过Xcode 12b的测试.

Here is a demo of possible solution. Tested with Xcode 12b.

List {
    ForEach(0..<3) { _ in
        VStack {
            Text("Hello, World!").padding(.leading)
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
        .listRowInsets(EdgeInsets())
        .background(Color.white)
    }
}

这篇关于如何在iOS 14中的SwiftUI 2.0中删除列表分隔符行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆