UICollectionView更新单个单元格 [英] UICollectionView update a single cell
问题描述
我正在尝试更新 UICollectionView
中的单个单元格,具体来说,我只是尝试更新由单元格引爆的特定单元格中的图像.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 UICollectionView
it 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 <中重新加载特定
indexPaths
的方法/ code>
Here it is a method to reload the specific indexPaths
in your collectionView
这篇关于UICollectionView更新单个单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!