iphone - How to make an forever scrolling UIScrollView with pagination? -


I have 20 items that the user can choose from. Now I want to create a UIScrollView with a curb on the enabled page, which allows to scroll anytime. If the end has reached, then it has been started, and so on.

What would be the simplest way to do something like that? I'm afraid that when I get offset, y = 10000.0f tells, it can affect memory, not sure.

Apart from this, a smooth "forever scrolling experience" is important. So just set offset 0/0 when the end will reach the end most likely will not work ... I remember that I tried a year ago, and the UICrewView completely animated the last thing (wrong direction, start from the end When the offset was set to something else).

A large offset does not consume excess memory; It requires that CoreAnimation deals with a large number, it is fine, except ...

There is a float on the CGFlot device (IIRC is double on Mac OS X). This means that it can represent an integer of approximately 2 24 (approximately 16.7 million), thus, approximately half a million (and "half-size pixels of" retina display " is). If the user scroll is too far, you will lose the accuracy. I'm not sure where it is right. You can set the content setting and content to set very large values ​​and try to see what happens.

If you really need the UIDT picture-style "forever" scrolling, then you have a few options:

  • Apply it to your own Also is not difficult, and the display that will not spoil (I think you get scrollwiddcroll: callback per frame).
  • Make ContentSize "Sufficiently large" (Approximately 1 million, but note that this should be larger than the size of the page) and the content is offset somewhere in the middle Reset content Middle-Eye When the user is stopped scrolling:
    • scrollViewDidEndDragging: willDecelerate: (but only then Declarate == No )
    • < Code> scrollViewDidEndDecelerating:
    • scrollViewDidEndScrollingAnimation:
    • scrollViewDidScrollToTop: (possibly; I is not sure itKrrol Viaidiadands scrolling Annimeshn: sends).

This means that users can hit the end and bounce if they try really hard (one million IPhone "points" is approximately 160 meters). Oh fine.


Comments