Pregunta

  • En un estado inicial, mi colección tiene tres celdas, en una sección : cell1, cell2 y cell3.

  • En el estado siguiente, el primer cambio de celda y se convierte en cell1_bis.Tiene el mismo tamaño.

Es posible animar este cambio cell1 -> cell1_bis?

¿Fue útil?

Solución

Respuesta

Proceder de esta manera:

 [self.collectionView

 performBatchUpdates:^
 {
     NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
                                                          inSection:section] ;

     [self.collectionView deleteItemsAtIndexPaths:@[whereTheChangeIs]] ;
     [self.collectionView insertItemsAtIndexPaths:@[whereTheChangeIs]] ;
 }

 completion:^(BOOL finished)
 {
     // nothing
 }] ;

Pregunta

Por desgracia, el siguiente no funciona.Bug?

 [self.collectionView

 performBatchUpdates:^
 {
     NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row
                                                          inSection:section] ;

     [self.collectionView reloadItemsAtIndexPaths:@[whereTheChangeIs]] ;
 }

 completion:^(BOOL finished)
 {
     // nothing
 }] ;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top