SwiftUi - 隐藏“返回"按钮和导航栏(出现几分之一秒) [英] SwiftUi - hide "Back" button and navigation bar (appears for a fraction of second)

查看:151
本文介绍了SwiftUi - 隐藏“返回"按钮和导航栏(出现几分之一秒)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码隐藏导航栏和后退按钮,但是当视图加载时,我仍然可以看到后退按钮几分之一秒然后消失.有什么办法可以防止它显示出来吗?

I'm using this code to hide a navigation bar and Back button but when the view is loaded i still can see the back button for a fraction of second and then it disappears. Is there any way to prevent it from being shown?

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

先谢谢你,

推荐答案

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

Add the same modifiers also for link destination,

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("")
    }
}

这篇关于SwiftUi - 隐藏“返回"按钮和导航栏(出现几分之一秒)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆