[英]How to remove back button from swiftui navigation stack but allow the user to move back when the screen is pinched from the left side of the screen
I my swiftui navigation stack i want to remove the back button from the view but i want to allow the user to move to the previous screen when it is pinched from the left hand side我的 swiftui 导航堆栈我想从视图中删除后退按钮,但我想让用户在从左侧捏住时移动到上一个屏幕
@main
struct MyApp: App {
@State private var path = [String]()
var body: some Scene {
WindowGroup {
NavigationStack(path: $path){
FirstView(path: $path)
}.navigationDestination(for: String.self) { string in
SecondView()
}
}
}
}
Now in my SecondView i have added .navigationBarHidden(true)
which removes the back button but also removes the ability to pinch back to the previous view现在,在我的 SecondView 中,我添加了
.navigationBarHidden(true)
,它删除了后退按钮,但也删除了收缩回到上一个视图的能力
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.