Boh*_*ych 3 ios swift swift5 swiftui
我无法隐藏NavigationView酒吧。我尝试了两种变体:
代码1:
public var body: some View {
NavigationView {
MasterView()
.navigationBarHidden(true)
}
}
Run Code Online (Sandbox Code Playgroud)
代码2:
public var body: some View {
NavigationView {
MasterView()
}
.navigationBarHidden(true)
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决它?
Giu*_*nza 13
Seems that the solution could be adding a title or removing the space from safe area.
The problem:
Solution 1:
.navigationBarHidden(true)
.navigationBarTitle(Text("Home"))
Run Code Online (Sandbox Code Playgroud)
Solution 2 (this seems be the best):
.navigationBarHidden(true)
.navigationBarTitle(Text("Home"))
.edgesIgnoringSafeArea([.top, .bottom])
Run Code Online (Sandbox Code Playgroud)