Assertion Failure in UICollectionViewData validateLayoutInRect on ios7

后端 未结 8 1239
误落风尘
误落风尘 2021-02-12 12:51

Assertion Failure in UICollectionViewData validateLayoutInRect on iOS7.

I am trying to delete all UICollectionView items, one by o

8条回答
  •  独厮守ぢ
    2021-02-12 13:03

    It looks like you probably want to do this:

    [self.CollectionView performBatchUpdates:^(void) {
      for (int i = count - 1; i >= 0; i--) {
        [collectionArray removeObjectAtIndex:i]; // First delete the item from you model
        [self.CollectionView deleteItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:i inSection:0]]];
      }
    } completion:nil];
    

    So that all the updates are performed together. Otherwise you will end up trying to perform several lots of batch updates on top of each other.

提交回复
热议问题