UICollectionView :comment animer le changement d'une cellule ?
Question
Dans un état initial, ma vue de collection comporte trois cellules, dans une seule section :
cell1
,cell2
etcell3
.Dans l'état suivant, la première cellule change et devient
cell1_bis
.Il a la même taille.
Est-il possible d'animer ce changement
cell1 -> cell1_bis
?
La solution
Répondre
Procédez de cette façon :
[self.collectionView
performBatchUpdates:^
{
NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
inSection:section] ;
[self.collectionView deleteItemsAtIndexPaths:@[whereTheChangeIs]] ;
[self.collectionView insertItemsAtIndexPaths:@[whereTheChangeIs]] ;
}
completion:^(BOOL finished)
{
// nothing
}] ;
Question
Malheureusement, ce qui suit ne fonctionne pas.Bogue?
[self.collectionView
performBatchUpdates:^
{
NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
inSection:section] ;
[self.collectionView reloadItemsAtIndexPaths:@[whereTheChangeIs]] ;
}
completion:^(BOOL finished)
{
// nothing
}] ;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow