【问题标题】:UICollectionView : how to animate the change of a cell?UICollectionView:如何为单元格的变化设置动画?
【发布时间】:2014-06-03 11:14:50
【问题描述】:
  • 在初始状态下,我的收藏视图在一个部分中有三个单元格:cell1cell2cell3

  • 在下一个状态下,第一个单元格更改为cell1_bis。它具有相同的大小。

是否可以为这个更改设置动画cell1 -> cell1_bis

【问题讨论】:

    标签: animation uicollectionview uicollectionviewcell uicollectionviewlayout


    【解决方案1】:

    回答

    继续往下:

     [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
     }] ;
    

    【讨论】:

      猜你喜欢
      • 2018-08-22
      • 1970-01-01
      • 2013-07-17
      • 2021-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多