Jak utworzyć UICollectionView z nieskończonym stronicowaniem?

Mam UICollectionView z 6 stronami i włączonym stronicowaniem oraz UIPageControl. To, czego chcę, gdy dotarłem do ostatniej strony, jeśli przeciągam w prawo, UICollectionView ładuje się płynnie od pierwszej strony.

- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender
{

// The key is repositioning without animation
if (collectionView.contentOffset.x == 0) {
    // user is scrolling to the left from image 1 to image 10.
    // reposition offset to show image 10 that is on the right in the scroll view
    [collectionView scrollRectToVisible:CGRectMake(collectionView.frame.size.width*(pageControl.currentPage-1),0,collectionView.frame.size.width,collectionView.frame.size.height) animated:NO];
}
else if (collectionView.contentOffset.x == 1600) {
    // user is scrolling to the right from image 10 to image 1.
    // reposition offset to show image 1 that is on the left in the scroll view
    [collectionView scrollRectToVisible:CGRectMake(0,0,collectionView.frame.size.width,collectionView.frame.size.height) animated:NO];

}
pageControlUsed = NO;

}

To nie działa tak, jak chcę. Co mogę zrobić?

questionAnswers(3)

yourAnswerToTheQuestion