我正在尝试更新UICollectionView
中的单个单元,具体地说,我只是尝试更新由cell.imageView
引爆的那个特定单元中的图像。[self.collectionView reloadData]
并不是一个真正的选择,因为它使整个集合视图闪现。[self.collectionView beginUpdates]
似乎不是UICollectionView
中的东西。
我知道我可以使用:
[self.collectionView performBatchUpdates:^{
//do something
} completion:nil];
我不太确定在完成块中放入什么来更新某个单元格的imageView
。这一切都是在didSelectItemAtIndexPath
.Also中完成的,我没有使用NSFetchedResultsController
。有什么想法吗?
发布于 2013-11-30 13:48:42
- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths
下面是在collectionView
中重新加载特定indexPaths
的方法
发布于 2013-12-02 06:34:53
Dinesh的回答很贴切。但为了避免在重新加载时出现不需要的动画(也称为“闪烁”),请使用:
BOOL animationsEnabled = [UIView areAnimationsEnabled];
[UIView setAnimationsEnabled:NO];
[myCollectionView reloadItemsAtIndexPaths:myIndexPaths];
[UIView setAnimationsEnabled:animationsEnabled];
https://stackoverflow.com/questions/20296929
复制相似问题