我正在嘗試使串列透明,因此只有步驟數和執行日期出現在背景上。有沒有辦法使灰色背景透明并且對串列單元格中的白色也做同樣的事情?
CustomNavigationLink(title: "Steps (Last 7 Days)") {
List(listSteps, id: \.id) { stepList in
VStack(alignment: .leading) {
Text("\(stepList.count)")
.font(.custom(customFont, size: 40))
.fontWeight(.semibold)
Text(stepList.date, style: .date)
.opacity(0.5)
.font(.custom(customFont, size: 20))
.foregroundColor(.cyan)
.padding(1)
}
}
.background(Image("GreenBG"))
.navigationTitle("Steps (last 7 days)")
.padding()
}
uj5u.com熱心網友回復:
您需要將 VStack 的串列行背景設定為清除:
VStack(alignment: .leading) {
Text("\(stepList.count)")
.font(.custom(customFont, size: 40))
.fontWeight(.semibold)
Text(stepList.date, style: .date)
.opacity(0.5)
.font(.custom(customFont, size: 20))
.foregroundColor(.cyan)
.padding(1)
}
.listRowBackground(Color.clear)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/425657.html
