UICollectionView recieved layout attributes for a cell with an index path that does not exist

后端 未结 3 1294
面向向阳花
面向向阳花 2021-01-14 12:21

I have used UICollection view to show items in grid layout.

For data source I have use 5*5 dimensional array.

And also I am returning 5 for numberOfItems in

3条回答
  •  不知归路
    2021-01-14 12:53

    It works for me.

    
        collectionView.reloadData()
        collectionView.collectionViewLayout.invalidateLayout()
    
    

    It comes because of the cache of the Cell's Autolayout when reloadData.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题