如何使用按钮而不是使用NavigationView或工作表从视图导航到另一个视图。
亲切的问候
答案 0 :(得分:0)
尝试一下:
you cannot navigate without navigationview, but you can hide navigationbar if you want to.
struct ContentView: View {
@State var navigate = false
var body: some View {
NavigationView {
VStack {
NavigationLink(destination: Text("aha"), isActive: self.$navigate) {
EmptyView().hidden()
}.frame(height:0)
Button(action: {
self.navigate = true
}) {
Text("go")
}
}
}
}
}