UICollectionView:如何为细胞的更改设置动画?
题
-
在初始状态下,我的集合视图有三个单元格,在一个部分中:
cell1
,cell2
和cell3
。 -
在下一个状态下,第一个单元格更改并变为生成扫描码。它具有相同的大小。
是可以为此更改生成的变化是可以的吗?
解决方案
答案
以这种方式进行:
[self.collectionView
performBatchUpdates:^
{
NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
inSection:section] ;
[self.collectionView deleteItemsAtIndexPaths:@[whereTheChangeIs]] ;
[self.collectionView insertItemsAtIndexPaths:@[whereTheChangeIs]] ;
}
completion:^(BOOL finished)
{
// nothing
}] ;
.
问题
不幸的是,以下不起作用。虫子?
[self.collectionView
performBatchUpdates:^
{
NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
inSection:section] ;
[self.collectionView reloadItemsAtIndexPaths:@[whereTheChangeIs]] ;
}
completion:^(BOOL finished)
{
// nothing
}] ;
. 不隶属于 StackOverflow