UICollectionView :como animar a mudança de uma célula?
Pergunta
Em um estado inicial, o meu modo de exibição de coleção tem três células, em uma seção :
cell1
,cell2
ecell3
.Na próxima estado, a primeira célula de mudança e torna-se
cell1_bis
.Ele tem o mesmo tamanho.
É possível animar esta alteração
cell1 -> cell1_bis
?
Solução
Responder
Prossiga desta forma:
[self.collectionView
performBatchUpdates:^
{
NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
inSection:section] ;
[self.collectionView deleteItemsAtIndexPaths:@[whereTheChangeIs]] ;
[self.collectionView insertItemsAtIndexPaths:@[whereTheChangeIs]] ;
}
completion:^(BOOL finished)
{
// nothing
}] ;
Pergunta
Infelizmente, o seguinte não funciona.Erro?
[self.collectionView
performBatchUpdates:^
{
NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
inSection:section] ;
[self.collectionView reloadItemsAtIndexPaths:@[whereTheChangeIs]] ;
}
completion:^(BOOL finished)
{
// nothing
}] ;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow