我正在尝试解决在应用程序视图上有2个“后退按钮”的问题。在我浏览两次之后,这似乎正在发生。一次从主屏幕创建帐户页面,然后再次从创建帐户页面转到另一个页面。使用NavigationView
我正在将此格式用于其他页面。
struct CreateAccountViewGeo: View {
var body: some View {
NavigationView{
GeometryReader { (deviceSize: GeometryProxy) in
ZStack{
NavigationLink(destination: SportPreference(), tag: 1, selection: self.$current) {
EmptyView()
}
VStack (spacing: deviceSize.size.height * (20/812)){
Button(action: {
self.current = 1
print("Create tapped!")
}) {
Text("Create")
.fontWeight(.bold)
.foregroundColor(.orange)
.frame(width: deviceSize.size.width*(185/375), height: deviceSize.size.height*(50/812))
.cornerRadius(50)
.overlay(
Capsule(style: .continuous)
.stroke(Color.orange, style: StrokeStyle(lineWidth: 2)))
.frame(width: deviceSize.size.width, alignment: .center)
}//Close button for create
}
}
}
}
您有多个NavigationView{...}
,其中一些