Samyag Shah Samyag Shah - 1 month ago 17
iOS Question

Paginating UIScrollView with infinite loop of three views

I want to create a

with three constant views. The middle view should always be displayed initially. When the user scrolls to the right, then View 1 will be the active view and the other two views will move as if there was a loop: View 3 will now be to the left, and View 2 on the right. The attached figure explains what I want:

Is this possible?


3 Pages Only

There may be times when you want an infinite page loop, but don’t want to load in a lot of content. For example, You may have a lot of content to display inside the UIScrollView. Loading large amounts of data there would not be the ideal approach to the situation.

The logic that we can use there is to keep the UIScrollView at just three pages. Data would load on each page and the user would always be looking at the data in the middle page. When the user scrolled to a new page, the content for each page would be reset and the offset would go back the user is back to viewing the middle page. That way even though you may have a large amount of data to scroll through, it’s not all loaded at once. Only three pages are ever loaded at one time.

... taken from (the now defunct)