SwiftUi-隐藏“后退”按钮和导航栏(显示时间不到一秒钟)

时间:2020-06-02 17:44:59

标签: swiftui navigationbar swiftui-navigationlink navigationlink

我正在使用此代码隐藏导航栏和“后退”按钮,但是在加载视图时,我仍然可以看到“后退”按钮一秒钟,然后消失。有什么办法可以防止它被显示?

var body: some View {
    NavigationView {
        NavigationLink(destination: DeferView { WeekView(journey: self.launcher.completeJourney!) }, isActive: self.$launcher.readyJourney ) { EmptyView () }
        .navigationBarHidden(true)
        .navigationBarTitle("")
    }
}

先谢谢您

1 个答案:

答案 0 :(得分:2)

还为链接目标添加相同的修饰符,

var body: some View {
    NavigationView {
        NavigationLink(destination: DeferView { WeekView(journey: self.launcher.completeJourney!) }
                                    .navigationBarHidden(true)   // here !!
                                    .navigationBarTitle("")      // here !!

              , isActive: self.$launcher.readyJourney ) { EmptyView () }
        .navigationBarHidden(true)
        .navigationBarTitle("")
    }
}