Assertion Failure in UICollectionViewData validateLayoutInRect on ios7

后端 未结 8 1238
误落风尘
误落风尘 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:17

    try to call [yourCollectionView.collectionViewLayout invalidateLayout];

    0 讨论(0)
  • 2021-02-12 13:18

    You should implement invalidateLayout in your layout class and remove all kinds of UICollectionViewLayoutAttributes items in your config.

    - (void)invalidateLayout{
      [super invalidateLayout];
      [self.itemsAttributes removeAllObjects];
    }
    

    For a better way to implement invalidateLayoutWithContext, see more about UICollectionViewLayoutInvalidationContext.

    From Apple Developer documentation:

    When implementing a custom layout, you can override this method and use it to process information provided by a custom invalidation context. You are not required to provide a custom invalidation context but might do so if you are able to provide additional properties that can help optimize layout updates. If you override this method, you must call super at some point in your implementation.

    0 讨论(0)
提交回复
热议问题