繁体   English   中英

Xcode SwiftUI UITableView 分隔符颜色形式“部分”文本

[英]Xcode SwiftUI UITableView separator color form “section” text

Xcode 12 / Swift 5 / SwiftUI

如何在 NavigationView 内的表单中删除每个文本 label 之间的分隔符?

我有这个,但每个文本之间仍然有一个分隔符,如何删除它?

struct ContentView: View {

    init() {
        UITableView.appearance().sectionHeaderHeight = .zero
        UITableView.appearance().backgroundColor = UIColor.white
        UITableView.appearance().separatorStyle = .none
    }

    var body: some View {

        NavigationView {

            Form {
                Section(){
                    Text("\(isbn ?? "")")
                    Text("\(foundBooks?.items.first?.volumeInfo.line1 ?? "")")
                    Text("\(foundBooks?.items.first?.volumeInfo.line2 ?? "")")
                    Text("\(foundBooks?.items.first?.volumeInfo.line3 ?? "")")
                    Text("\(foundBooks?.items.first?.volumeInfo.line4 ?? "")")
                    Text("\(foundBooks?.items.first?.volumeInfo.line5 ?? "")")
                    Text("\(foundBooks?.items.first?.volumeInfo.line6 ?? "")")
                }
            }
        }
    }
}

我虽然在initUITableView.appearance().separatorStyle =.none会这样做,但它没有

添加什么代码以及在何处添加以删除每个Text()...

挖了一下我发现了这个

Form {
                Section(){
                    Text("\(isbn ?? "")")........
                }.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
                .listRowInsets(EdgeInsets())
                .background(Color.white)
            }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM