提问人:eugene_prg 提问时间:6/3/2020 更新时间:6/3/2020 访问量:3491
SwiftUi - 隐藏“后退”按钮和导航栏(出现几分之一秒)
SwiftUi - hide "Back" button and navigation bar (appears for a fraction of second)
问:
我正在使用此代码隐藏导航栏和后退按钮,但是当加载视图时,我仍然可以看到后退按钮几分之一秒,然后它消失了。有什么方法可以防止它被显示出来吗?
var body: some View {
NavigationView {
NavigationLink(destination: DeferView { WeekView(journey: self.launcher.completeJourney!) }, isActive: self.$launcher.readyJourney ) { EmptyView () }
.navigationBarHidden(true)
.navigationBarTitle("")
}
}
先谢谢你,
答:
4赞
Asperi
6/3/2020
#1
也为链接目标添加相同的修饰符,
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("")
}
}
评论
0赞
Bhuvan Bhatt
2/2/2022
这对我不起作用,你还有其他建议吗?我的代码: struct FirstSwiftUIView: View { var body: some View { VStack { Text(“First SwiftUi View”) NavigationLink { SecondSwiftUIView() } label: { Text(“Next View”) } } .navigationBarBackButtonHidden(true) .navigationBarTitle(“”) } }
评论