NavigationLink issue

Good day, I have the problem that when I switch from one view to another, the content is moved to the bottom every time. I have already tried with the: See picture attached: [https://we.tl/t-SUYZZh6M2P)

Does anyone have a solution suggestion?

Greetings

  • Can you share your code by showing it as text, not as image?

  • Yes I can do that.

Add a Comment

Replies


    var body: some View {

        NavigationView {

            VStack {

                

                Image(systemName: "cross.fill")

                    .font(.system(size: 150))

                    .foregroundColor(Color(.systemRed))

                

                

                Text("SOS")

                    .font(.system(size: 40, weight: .bold))

            }

            

            

            .toolbar{

                ToolbarItemGroup(placement: .bottomBar) {

                    Image(systemName: "cross.fill")

                        .font(.system(size: 30.0))

                        .foregroundColor(Color(.systemRed))

                        

                    

                    Spacer()

                    

                    NavigationLink(destination: heartTextSquareView().navigationBarBackButtonHidden(true)) {

                        Image(systemName: "heart.text.square")

                            .font(.system(size: 30.0))

                            .foregroundColor(Color(.systemRed))

    

                    }

                    

                    

                    Spacer()

                    

                    NavigationLink(destination: keyView().navigationBarBackButtonHidden(true)) {

                        Image (systemName: "key")

                            .font(.system(size: 30.0))

                            .foregroundColor(Color(.systemRed))

                    }

                    

                    

                    Spacer()

                    

                    Image (systemName: "gearshape")

                        .font(.system(size: 30))

                        .foregroundColor(Color(.systemRed))

                }

                

            }

            

            

            

            

        }

        

        

    }

when I switch from one view to another, the content is moved to the bottom every time

This issue would be caused by the code in "heartTextSquareView", which you have not shared.

  • Thank you very much. So "cross.fill" is the content view (MainView) then I would also have to mention it with a navigation link?

  • Yep.

  • Thank you for your answer. I will try it

Add a Comment