I’m trying to make a paging UIScrollView display multiple pages at the same time, in effect, making the page size smaller than the UIScrollview‘s bounds. I’ve been googling for hours, but nobody seems to have a good solution.
I’m able to get the right effect visually by sizing the UIScrollview to the size I want one page to be, turning off subview clipping, and placing it inside a container that passes all of its taps to the UIScrollview. The problem with this is that with Y pages visible, it lets you scroll the last page all the way to the left, leaving Y-1 empty pages after the last page. Anyone know a way around this, or another approach to the problem?
For the right end, try reducing the width of the scroll view’s
contentSizeproperty enough that the scroll view will stop paging before it gets to the last page.For the left end, reduce the
frame.origin.xproperty of each page by the same amount. The first few pages will have a negative x position within the scroll view.Essentially, makeing the scroll view think that it’s content is only pages 2 through second to last.
For example:
Forgive any typos in the code. I haven’t tried this yet myself.
Let me know if it works.