Thursday, September 28, 2023
HomeiOS Developmentios - Heart Scroll View content material

ios – Heart Scroll View content material

[ad_1]

I have centered my Scroll View by using GeometryReader like this:

struct ContentView: View {
    var body: some View {
        NavigationView {
            GeometryReader { geom in
                ScrollView(.vertical, showsIndicators: false) {
                    ZStack { 
                        my_super_view()
                    }
                    .navigationBarTitle("Main")
                    .frame(width: geom.size.width)
                    .frame(minHeight: geom.size.height)
                }
            }
        }.navigationViewStyle(StackNavigationViewStyle())
    }
}

enter image description here

And it works almost great. My problem is that the height of container ZStack is too big and the page could be scrolled down like this:
enter image description here
And when i try to do smth like:

.frame(minHeight: geom.size.height-52)

The page stops scrolling, but is poorly centered. How can I properly center the page so that it fits entirely on the main screen without scrolling below it?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments