首页 > 解决方案 > swift ui 导航栏后退按钮仅被隐藏它正在占用空间和多个后退按钮占用空间询问我导航到其他页面

问题描述

                    NavigationLink("", destination: login(),isActive: $goWhenTrue)
                        
                    
                  
                    Button (action: { print("Button Tapped")}, label: {

                        Text("LogOut")
                            .font(.headline)
                            .foregroundColor(.white)
                            .frame(width: 340, height: 50)
                            .background(Color.blue)
                            .clipShape(Capsule())
                            .padding()
                            .onTapGesture {
                                self.goWhenTrue = true
                                UserDefaults.standard.removeObject(forKey:"Username")
                            }
                        
                    })
                    .shadow(color: .gray, radius: 15, x: 0.0, y: 0.0)
                    
                    Spacer()
                     
                }.padding(.bottom)
                
                .navigationBarTitle(Text("Welcome Home"), displayMode: .automatic)
               
                .navigationBarBackButtonHidden(true)

在这个 swift UI 程序中,我试图从每个页面中消除后退按钮,但我只能将其隐藏,然后它也会占用空间。我想在移动到登录页面时删除间距,后退按钮将登录页面向下推需要确保不会发生任何人都可以帮助我吗?

标签: swiftswiftuiswiftui-navigationlinkswiftui-navigationview

解决方案


推荐阅读