• 在初始状态下,我的集合视图有三个单元格,在一个部分中:cell1cell2cell3

  • 在下一个状态下,第一个单元格更改并变为生成扫描码。它具有相同的大小。

是可以为此更改生成的变化是可以的吗?

有帮助吗?

解决方案

答案

以这种方式进行:

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top