UICollectionView Assertion failure

前端 未结 14 2221
别那么骄傲
别那么骄傲 2020-11-29 17:27

I m getting this error on performing insertItemsAtIndexPaths in UICollectionView

Assertion failure in:

-[UICollectionViewD         


        
14条回答
  •  情书的邮戳
    2020-11-29 18:09

    I ran into this very same problem when inserting the first cell into a collection view. I fixed the problem by changing my code so that I call the UICollectionView

    - (void)reloadData
    

    method when inserting the first cell, but

    - (void)insertItemsAtIndexPaths:(NSArray *)indexPaths
    

    when inserting all other cells.

    Interestingly, I also had a problem with

    - (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths
    

    when deleting the last cell. I did the same thing as before: just call reloadData when deleting the last cell.

提交回复
热议问题