collectionView

-(void) nextpage{
 NSIndexPath *currentIndexPath = [[self.collectionView indexPathsForVisibleItems] lastObject];
 
 NSIndexPath *currentIndexPathReset = [NSIndexPath indexPathForItem:currentIndexPath.item inSection:YYMaxSections/2];
 [self.collectionView scrollToItemAtIndexPath:currentIndexPathReset atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
 
 NSInteger nextItem = currentIndexPathReset.item +1;
 NSInteger nextSection = currentIndexPathReset.section;
 if (nextItem==self.newses.count) {
 nextItem=0;
 nextSection++;
 }
 NSIndexPath *nextIndexPath = [NSIndexPath indexPathForItem:nextItem inSection:nextSection];
 
 [self.collectionView scrollToItemAtIndexPath:nextIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:YES];
}

posted on 2016-07-19 15:53  我就是一种相逢  阅读(149)  评论(0编辑  收藏  举报

导航