Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>(hope I'm posting this correctly - I'm new here!?)</p> <p>mvds was spot on - thanks - subclassing UIScrollView works perfectly - I'm yet to implement the shifting and loading of new data, but I have a UIScrollView that scrolls round in an endless loop!</p> <p>Heres the code:</p> <pre><code>#import "BRScrollView.h" @implementation BRScrollView - (id)awakeFromNib:(NSCoder *)decoder { offsetAdjustment = 0; [super initWithCoder:decoder]; return self; } - (void)setContentOffset:(CGPoint)contentOffset { float realOffset = contentOffset.x + offsetAdjustment; //This happens when contentOffset has updated correctly - there is no need for the adjustment any more if (realOffset &lt; expectedContentOffset-2000 || realOffset &gt; expectedContentOffset+2000) { offsetAdjustment = 0; realOffset = contentOffset.x; } float pageNumber = realOffset / 320; float pageCount = self.contentSize.width / 320; if (pageNumber &gt; pageCount-4) { offsetAdjustment -= 3200; realOffset -= 3200; } if (pageNumber &lt; 4) { offsetAdjustment += 3200; realOffset += 3200; } //Save expected offset for next call, and pass the real offset on expectedContentOffset = realOffset; [super setContentOffset:CGPointMake(realOffset, 0)]; } - (void)dealloc { [super dealloc]; } @end </code></pre> <p>Notes:</p> <p>If you actually want an infinite loop, you'd need to adjust the numbers - this codes notices when you get near the edge and moves you to just beyond the middle</p> <p>My contentSize is 6720 (21 pages)</p> <p>I'm only interest in scrolling horizontally, so only save the x values and hard code the y to 0!</p> <p>Ben</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload