Animation UICollectionView:如何设置单元格更改的动画?

Animation UICollectionView:如何设置单元格更改的动画?,animation,uicollectionview,uicollectionviewcell,uicollectionviewlayout,Animation,Uicollectionview,Uicollectionviewcell,Uicollectionviewlayout,在初始状态下,“我的收藏”视图在一个部分中有三个单元格:cell1、cell2和cell3 在下一个状态中,第一个单元格改变并成为cell1\u bis。它的大小一样 是否可以设置此更改的动画cell1->cell1\u bis 答复 这样做: [self.collectionView performBatchUpdates:^ { NSIndexPath * whereTheChangeIs = [NSIndexPath indexPathForItem:row

在初始状态下,“我的收藏”视图在一个部分中有三个单元格:
cell1
cell2
cell3

  • 在下一个状态中,第一个单元格改变并成为
    cell1\u bis
    。它的大小一样

  • 是否可以设置此更改的动画
    cell1->cell1\u 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
     }] ;