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

查看:30
本文介绍了如何在 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天全站免登陆