问题
I have a nested scroll view situation such as follow-
mainView->ScrollView1->ScrollView3(has many child ScrollView vertical)
*I want that when that when the user scrolls down then,first the scrollView1 will scroll dragging the displayed childScrollView3 along with it.(scrollView2's user interaction as well as scroll should be disabled)*
2)*And after it has reached its end the childScrollView3 will scroll with the same velocity that scrollView1 was scrolling ?*
Same should happen when user scrolls downward i.e childScrollView3 will first come to its end & then the scrollView1 shall scroll to top.
UPDATE
Mark - I searched on goole for parallax but that was not helpful as I have a paging scroll view with multiple vertical child scrolls.
回答1:
override the
func scrollViewDidScroll(_:) in UIScrollViewDelegate
method to watch for the fine grain scrolling of the UIScrollViews.
You can use the contentOffset variable of the scrollView to find when you should start scrolling the next one. You'll have to do some math to determine how much the scrollView the user is touching was offset in-between calls of this method to determine how much to scroll the next scrollView by to keep the "animation" the same across both.
来源:https://stackoverflow.com/questions/35745353/nested-scroll-auto-scroll-one-after-another-has-reached-its-end-point