获取当前显示的cell的下标

 

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{

    // 获取当前显示的cell的下标

    NSIndexPath *firstIndexPath = [[self.collctionMain indexPathsForVisibleItems] firstObject];

    // 赋值给记录当前坐标的变量

    _cellImgV.image = [UIImage imageNamed:self.pictureArr[firstIndexPath.row]];

 

}


你可能感兴趣的:(获取当前显示的cell的下标)