iPhone:UICollectionView的Indexpath.row

iPhone:UICollectionView的Indexpath.row,iphone,uicollectionview,nsindexpath,Iphone,Uicollectionview,Nsindexpath,我试图重新制作iOS的图像库 在图像的详细信息屏幕中,我想更新导航栏的标题,使其类似 3 of 19 是否有方法获取可见对象的当前indexath.row,并在UICollectionView停止滚动并更新“3/19”标题时更新该行旁边的图像标题。此代码工作正常 - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAt

我试图重新制作iOS的图像库

在图像的详细信息屏幕中,我想更新导航栏的标题,使其类似

3 of 19
是否有方法获取可见对象的当前indexath.row,并在UICollectionView停止滚动并更新“3/19”标题时更新该行旁边的图像标题。

此代码工作正常

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
    BOPhotoCollectionViewCell* currentCell = ([[collectionView visibleCells]count] > 0) ? [[collectionView visibleCells] objectAtIndex:0] : nil;
    if(cell != nil){
        _index = [collectionView indexPathForCell:currentCell].row;
        [self updateTitle];
    }
}
这个代码很好用

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
    BOPhotoCollectionViewCell* currentCell = ([[collectionView visibleCells]count] > 0) ? [[collectionView visibleCells] objectAtIndex:0] : nil;
    if(cell != nil){
        _index = [collectionView indexPathForCell:currentCell].row;
        [self updateTitle];
    }
}

实现UIScrollViewDelegate的以下委托方法(因为UICollectionViewDelegate继承自UIScrollViewDelegate)


实现UIScrollViewDelegate的以下委托方法(因为UICollectionViewDelegate继承自UIScrollViewDelegate)