Swift 快速导航链接问题
我在Swift和iOS 14中遇到了Swift 快速导航链接问题,swift,swiftui,swiftui-navigationlink,Swift,Swiftui,Swiftui Navigationlink,我在Swift和iOS 14中遇到了NavigationLink问题。这是一个已知的问题,但是我看到的问题解决者还不够。我发现当一个带有NavigationLink的按钮被提前初始化时,它就工作了,当你进入页面时,你就有了“返回”按钮。但是,当导航链接在中间时,当您进入页面时不能返回,必须关闭应用程序才能再次进入主屏幕。 这是我正在使用的代码: HStack { Button(action: { if let url = URL(string: "I black
NavigationLink
问题。这是一个已知的问题,但是我看到的问题解决者还不够。我发现当一个带有NavigationLink
的按钮被提前初始化时,它就工作了,当你进入页面时,你就有了“返回”按钮。但是,当导航链接在中间时,当您进入页面时不能返回,必须关闭应用程序才能再次进入主屏幕。
这是我正在使用的代码:
HStack {
Button(action: {
if let url = URL(string: "I blacked this out to make no advert here") {
UIApplication.shared.open(url)
}
}){
Text("Rate App").foregroundColor(.gray)
}.modifier(navigationButtonViewStyle())
Spacer()
// this navigation link works fine
NavigationLink(destination: HelpView()) {
Text("FAQ").foregroundColor(.gray)
}.modifier(navigationButtonViewStyle())
}.padding(.horizontal, 20)
VStack {
Text("λSET")
.font(.largeTitle)
.fontWeight(.heavy)
.bold()
.padding(.top, 50)
.onAppear(perform: prepareHaptics)
.animation(.linear)
Text("λudio System Engineer Tools")
.fontWeight(.light)
.animation(.linear(duration: 0.5))
HStack {
Spacer()
// this navigation link is not showing the go back button when pressed and directed to the new screen
NavigationLink(destination: AboutView()) {
Text("About λSET")
.fontWeight(.heavy)
.bold()
}
Spacer()
}.modifier(calcTitleViewStyle())
.padding(.top, 20)
.padding(.bottom, 60)
}
我不确定问题出在哪里,但我很好奇这可能是什么。我正在研究一个变通方法,但我很想从根本上解决这个问题
谢谢 通过显式地将.NavigationBar设置为true来强制swift加载它,自己修复了这个问题。这在其他页面中是不需要的,但我现在正在做一些事情,以确保IOS14接受它,因为其中有一些内容已经更改