Ios 在UICollectionView中使用分页选项显示图像

Ios 在UICollectionView中使用分页选项显示图像,ios,uicollectionview,Ios,Uicollectionview,我在Instagram API的UICollectionView中显示图像,有分页选项可以加载更多图像,现在我的问题是当我获取下一页图像并重新加载UICollectionView时,它从一开始就重新加载,而不仅仅是从第二页图像 这是我的密码 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ NSLog(@"%d",arrUrlImage

我在Instagram API的UICollectionView中显示图像,有分页选项可以加载更多图像,现在我的问题是当我获取下一页图像并重新加载UICollectionView时,它从一开始就重新加载,而不仅仅是从第二页图像

这是我的密码

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
NSLog(@"%d",arrUrlImage.count);
return arrUrlImage.count;
}



 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

NSString *identifier=@"cell";



UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];



UIImageView *imgView=(UIImageView*)[cell viewWithTag:100];


int indexValue = arc4random() % 6;
UIColor *color=[arrCellBGColor objectAtIndex:indexValue];
cell.backgroundColor=color;
[UIView animateWithDuration:2 animations:^{
    cell.backgroundColor=[UIColor clearColor];
} completion:NULL];
NSURL *url=[NSURL URLWithString:[arrUrlImage objectAtIndex:indexPath.row]];

[self downloadImageWithURL:url completionBlock:^(BOOL succeeded, UIImage *image) {

    if (succeeded) {
        imgView.alpha = 0;
        [UIView animateWithDuration:2 animations:^{
            imgView.alpha = 1;
        }];
        // change the image in the cell
        // cell.imageView.image = image;

        // cache the image for use later (when scrolling up)

        imgView.image=image;
    }
}];


if (indexPath.row==arrUrlImage.count-3) {
    NSLog(@"load more image.");
    NSString *nextPageUrl=[[arrMedia valueForKey:@"pagination"] valueForKey:@"next_url"];
    [arrMedia removeAllObjects];
    NSLog(@"%@",nextPageUrl);
    [self grabMedia:nextPageUrl];


}






return cell;
}