UICollectionView 更新单个单元格 [英] UICollectionView update a single cell

查看:53
本文介绍了UICollectionView 更新单个单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更新 UICollectionView 中的单个单元格,具体来说,我只是尝试更新由 cell.imageView 引爆的特定单元格中的图像.[self.collectionView reloadData] 并不是一个真正的选项,因为它使整个集合视图闪烁.[self.collectionView beginUpdates] 似乎不是 UICollectionView 中的东西.

I am attempting to update a single cell inside a UICollectionView, specifically I am just trying to update an image in that specific cell detonated by cell.imageView. [self.collectionView reloadData] is not really an option because it makes the whole collection view flash. [self.collectionView beginUpdates] is not a thing in a UICollectionViewit seems.

我知道我可以使用:

[self.collectionView performBatchUpdates:^{
    //do something
} completion:nil];

我不确定在完成块中放什么来更新特定单元格的 imageView.这一切都在 didSelectItemAtIndexPath 内完成.此外,我没有使用 NSFetchedResultsController.有什么想法吗?

I am not exactly sure what to put inside a completion block to update that certain cell's imageView. This is all being done inside of didSelectItemAtIndexPath.Also I am not using NSFetchedResultsController. Any ideas?

推荐答案

- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths

这里是一种在你的 collectionView

这篇关于UICollectionView 更新单个单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆