swiftui iOS 14中分隔符颜色为白色
Xcode 12 iOS 14 Swift用户界面 如何更改列表中的分隔符颜色,请查看下面的代码swiftui iOS 14中分隔符颜色为白色,ios,swift,iphone,swiftui,ios14,Ios,Swift,Iphone,Swiftui,Ios14,Xcode 12 iOS 14 Swift用户界面 如何更改列表中的分隔符颜色,请查看下面的代码 struct SettingMenu: View { var settings: [Setting] = SettingItems.options var body: some View { List{ ForEach(settings, id: \.self) { setting in HStack{ Image(sy
struct SettingMenu: View {
var settings: [Setting] = SettingItems.options
var body: some View {
List{
ForEach(settings, id: \.self) { setting in
HStack{
Image(systemName: setting.imageName)
.frame(width: 25, height: 25).foregroundColor(Color.white)
Text(setting.title)
.font(.callout).foregroundColor(Color.white)
}
}.listRowBackground(Color(red: 62 / 255, green: 56 / 255, blue: 104 / 255)).cornerRadius(25)
}
.onAppear() {
UITableView.appearance().backgroundColor = UIColor.clear
UITableView.appearance().separatorStyle = .singleLine
}
}
}
我尝试了UITableView.appearance().separatorColor=UIColor.white
,但它对我不起作用
提前感谢如果您有一个正常列表,请使用LazyVStack。尝试将这些设置移动到
init()
而不是出现。