HomeiOS DevelopmentHow can I've a ScrollView scroll its contents to align with one...

How can I’ve a ScrollView scroll its contents to align with one other View’s backside edge?


var physique: some View {
        ZStack(alignment: .high) {
            dateAndTime
            ScrollView {
                VStack {
                    storyContent
                }
            }

        }

How can I get the VStack to align its high edge with the underside fringe of the dateAndTime label when scrolling down as a substitute of bouncing again as much as the highest of the ScrollView?

Initially, I would like the VStack to cover the dateAndTime however I would like the consumer to have the ability to scroll and reveal the dateAndTime label whereas sustaining the 2 views aligned edge-to-edge when the consumer stops scrolling as a substitute of resetting it is scroll place to the highest.

I attempted placing the dateAndTime within the background of the ScrollView and utilizing .scrollTargetLayout with .scrollTargetBehavior nevertheless it did not work. I feel it is as a result of the dateAndTime label is outdoors the ScrollView. I am unsure find out how to use scroll targets or anchors.

How can I’ve a ScrollView scroll its contents to align with one other View’s backside edge?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments