Infinitely scrolling paging scrollview

235 Views Asked by At

My UIScrollView has 3 pages, with a separate UIView on each page. This is set up using auto layout. When the app launches, there is one view offscreen to the left, another that is onscreen, and a third offscreen to the right.

When the user pages to either side, there will be one view onscreen, with two views offscreen on the same side. What I want to be able to do is move the view furthest offscreen to the other side of the scrollview, to make it so that the scroll view can page infinitely.

I tried changing the constraints in scrollViewDidEndDragging(_:willDecelerate), but this approach is not working.

Is this effect plausible? If so, how can I achieve this effect?

Edit: One reason the approach before doesn't work is because the user can scroll past the paging without this delegate method being called. I am currently trying to see if the didScroll method will allow for the effect I am going for, but I haven't gotten this to the point where I can test it yet.

0

There are 0 best solutions below