0

I have a ScrollView embedded in a NavigationView, and I'd like to set the background (behind everything). I'm using the following code:

ScrollView{
        VStack{
            HStack{
               ...
            }
            .padding()
            .background(
                RoundedRectangle(cornerRadius: 5)
                    .fill(Color(colorScheme == .dark ? .secondarySystemBackground : .systemBackground))
                    .shadow(radius: 4)
            ).padding()
        }
    }
    .background(
        Image("login-bg").resizable().scaledToFill().edgesIgnoringSafeArea(.bottom)
    )

But it causes the navigation title to no longer collapse.

enter image description here

I've seen Screen Background Color With ScrollView And Navigation Bar SwiftUI but the solution there didn't work for me. Any ideas? Thank you!

mginn
  • 16,036
  • 4
  • 26
  • 54

0 Answers0