开发者

Is there an easy way to make a horizontally paged UIScrollView wrap around? [duplicate]

This question already has answers here: Closed 10 years ago.

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜