Domanda

    .
  • In uno stato iniziale, la mia vista di raccolta ha tre celle, in una sezione: cell1, cell2 e cell3.

  • nello stato successivo, la prima cella cambia e diventa cell1_bis.Ha le stesse dimensioni.

.

È possibile animare questo cambiamento cell1 -> cell1_bis?

È stato utile?

Soluzione

Risposta

Procedi in questo modo:

 [self.collectionView

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

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

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

domanda

Sfortunatamente, quanto segue non funziona.Bug?

 [self.collectionView

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

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

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top