UICollectionView:セルの変更をアニメートする方法は?
質問
-
初期状態では、My Collection Viewには3つのセルがあり、1つのセクションでは、
cell1
、cell2
、cell3
。 -
次の状態では、最初のセルが変化し、
cell1_bis
になります。同じサイズです。
この変更をアニメートすることは可能です。
解決
回答
このように進む:
[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