![](/img/trans.png)
[英]SwiftUI List with SidebarListStyle does not have Rounded Corners?
[英]SwiftUI: Background color of List with SidebarListStyle?
您可以将此修饰符.listRowBackground()
用于单独行的背景颜色。
struct ContentView: View {
private var items = ["1", "2", "3"]
init(){
UITableView.appearance().backgroundColor = .purple // background color of list
}
var body: some View {
List {
ForEach(items, id: \.self) { item in
Text(item)
.listRowBackground(Color.yellow) // background color of listRow
Text(item)
.listRowBackground(Color.blue) // background color of listRow
}
}
.frame(width: 300, height: 600)
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.