Is there an easy way to make a horizontally paged UIScrollView wrap around? [duplicate]
Possible Duplicate:
UIScrollView. Any thoughts on implementing “infinite” scroll/zoom?
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.
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).
精彩评论