是否可以更改NavigationView的颜色或使其清晰可见,从而使下面的元素可见?
struct SwiftUIView: View {
var body: some View {
ZStack {
Color.red.edgesIgnoringSafeArea(.all) //not visible beacause of NavigationView
NavigationView {
Text("Hello, World!")
}.background(Color.clear) //this does nothing
}
}
}
答案 0 :(得分:0)
我会这样做:
struct SwiftUIView: View {
var body: some View {
NavigationView {
ZStack{
Color.red.edgesIgnoringSafeArea(.all)
Text("Hello, World!")
}
}
}
}