【发布时间】:2020-05-10 14:01:45
【问题描述】:
我有一个:
contentView()
SignUpView()
SignInView()
contentView 调用SignInView()
struct ContentView: View {
var body: some View {
NavigationView {
SignInView()
}
}
}
在我的 SignUpView() 中,我有:
var body: some View {
VStack(alignment: .leading) {
NavigationLink(destination: SignInView()) {
Text("Sign in")
.fontWeight(.semibold)
.foregroundColor(Color("startColor"))
}
}.navigationBarHidden(true)
在我的 SigbInView 中,我有:
var body: some View {
VStack(alignment: .leading) {
NavigationLink(destination: SignUpView()) {
Text("Sign up")
.fontWeight(.semibold)
.foregroundColor(Color("startColor"))
}.navigationBarHidden(true)
我使用.navigationBarHidden(true) 隐藏栏,但< back 仍然出现在左上角带您回到上一个屏幕,我还尝试添加导航栏text = "" 并将属性设置为@ 987654329@
我试图仅在 SignInView 和 SignUpViews 上使用这些 navigationLinks 进行导航,我不希望栏出现或将视图向下推。
【问题讨论】:
-
我想你在错误的地方使用了
.navigationBarHidden(true),它运作良好。它应该在 NavigationView 中。 -
@Asperi,刚刚更新了我的问题以显示更多代码
标签: swiftui swiftui-navigationlink