【发布时间】:2020-11-15 18:47:44
【问题描述】:
似乎无法理解这件事。在我的列表中,我在文本之前有这些白色(暗模式下为黑色)线条,我无法摆脱它们。有人告诉我,这意味着我编码错误。但它是什么?这是我的代码:
import SwiftUI
struct ContentView: View {
init(){
UITableView.appearance().backgroundColor = .clear
}
var body: some View {
List {
Text("List Item 1").listRowBackground(Color("customColor"))
Text("List Item 2").listRowBackground(Color("customColor"))
Text("List Item 3").listRowBackground(Color("customColor"))
Text("List Item 4").listRowBackground(Color("customColor"))
Text("List Item 5").listRowBackground(Color("customColor"))
}.background(Color("customColor"))
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
然后在 appDelegates (didFinishLaunchingWithOptions) 我把这个:
UITableView.appearance().separatorColor = .darkGray.
找到了几个关于列表背景颜色的主题,但似乎没有人关心这些烦人的线条。我该怎么做才能摆脱它们?
【问题讨论】:
-
哇,出了点问题! [![在此处输入图像描述][1]][1] 不属于此处。我试图在我的问题中添加图片。如何更新问题?
-
Xcode 12 / iOS 14 没有这种效果
-
11.6 不是最新的吗?
标签: uitableview swiftui list-separator