iOS CollectionView滚动结束代理,默认滚动为最左边

  • (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    // 动画停止, 重新定位到第 50 组模型
    int inc = ((int)(scrollView.contentOffset.x / scrollView.frame.size.width)) % self.data.count;
    [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:50 * self.data.count + inc inSection:0] atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
    }

推荐阅读更多精彩内容