![](/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.