I made three views navigations like that code :
struct view1 : View{
var body : some View
{
NavigationView{
NavigationLink(destination : view2())
}
}.navigationBarTitle("").navigationBarhidden(true)
}
struct view2 : View{
var body : some View
{
VStack{
NavigationLink(destination : view3())
}
}.navigationBarTitle("").navigationBarhidden(true)
}
struct view3 : View{
var body : some View
{
Text("Hey")
}.navigationBarTitle("").navigationBarhidden(true)
}
The bar is hidden on View1 and View2,
but there still remain navigation bar space on view3.
How can I remove navigation bar absolutely on multiple stack of navigation views?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
I use viewModifier to make my view to build non clickable(I can click the view behind upper non clickable view)
struct NoHitTesting: ViewModifier {
func body(content: Content) -> some View {
SwiftUIWrapper { content }.allowsHitTesting(false)
}
}
extension View {
func userInteractionDisabled() -> some View {
self.modifier(NoHitTesting())
}
}
struct SwiftUIWrapper<T: View>: UIViewControllerRepresentable {
let content: () -> T
func makeUIViewController(context: Context) -> UIHostingController<T> {
UIHostingController(rootView: content())
}
func updateUIViewController(_ uiViewController: UIHostingController<T>, context: Context) {}
}
and I also made navigation view and navigation link. trying to make navigation bar hidden.
@EnvironmentObject var shared : SharedStatus
var body: some View {
NavigationView{
VStack{
NavigationLink(destination: View2())
{
Text("Its First")
}
Spacer()
}.nvHid()
}
}
}
extension View{
func nvHid() -> some View{
return self.navigationTitle("").navigationBarBackButtonHidden(true).navigationBarHidden(true)
}
}
struct View2 : View{
var body : some View{
VStack{
NavigationLink(destination: View3())
{
Text("Its second")
}
Text("hahah").userInteractionDisabled()
Spacer()
}.nvHid()
}
}
but still navigation bar remains.
how can I fix it..?