[英]How to remove the background in NavigationLinks?
如何删除导航链接的背景颜色(灰色的东西)。 我尝试将背景颜色设置为清除,但这似乎没有任何作用:
struct DesignView: View {
@State var index: Int
@State var selection: Int
var body: some View {
ZStack(alignment: .center){
RoundedRectangle(cornerRadius: 90.0)
.fill(Color.white)
.frame(height: 50)
NavigationLink(
destination: GraphView(type: selection, index: index),
label: {
Text("Warm Up #\(index)")
.font(.system(size: 20, weight: .bold, design: .rounded))
.foregroundColor(.black)
.backgroundStyle(
Color.clear
)
})
.backgroundStyle(
Color.clear
)
.padding()
}
}
}
我找到了解决方案:
导航链接响应色调,而不是为此目的的 bcgrnd 颜色:
NavigationLink(
destination: GraphView(type: selection, index: index),
label: {
Text("Warm Up #\(index)")
.font(.system(size: 20, weight: .bold, design: .rounded))
.foregroundColor(.black)
.backgroundStyle(
Color.clear
)
})
.tint(Color.clear)
.backgroundStyle(
Color.clear
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.