![](/img/trans.png)
[英]Is it possible to have different separator color for each section in 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 ?? "")")
}
}
}
}
}
我雖然在init
行UITableView.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.