views:

340

answers:

1

I notice that in the stocks application, the small graph wraps around, eg: when you get to the end of the scroll view and swipe right again, you go back to the beginning. Before I go ahead and code this myself is there an easy way to do this in the SDK? I can't find any properties or methods that would enable that?

I have a paged UIScrollView that scrolls horizontally, pretty much exactly like the stocks application one does.

+3  A: 

I don't think there's a property to do this. I've faked it by adding an extra page on each end, so with for a 5 page UIScrollView you'd set the contentSize for 7 pages and load them like this:

5 1 2 3 4 5 1

Then in scrollViewDidEndDecelerating:, check if you're at either end and if so call scrollRectToVisible:animated: on your UIScrollView to jump it to the "real" page 1 or 5 position (without animation).

John N