Synchronizing UIScrollView scrolling

2019-06-18 00:42发布

I have three UIScrollViews, scrollView1, scrollView2, and scrollView3. When scrollView1 is scrolled then scrollView2 should scroll horizontally with it, and when scrollView3 is scrolled then scrollView2 should scroll vertically with it. How can I do this?

1条回答
来,给爷笑一个
2楼-- · 2019-06-18 01:26

The UIScrollViewDelegate protocol includes scrollViewDidScroll:.

You could set the contentOffset of your subserviant scrollviews using setContentOffset in scrollView2 and scrollView3 from scrollView1's delegate's scrollViewDidScroll:

查看更多
登录 后发表回答