contentSize is not updated after reloadData is called on UICollectionView

前端 未结 5 2003
醉话见心
醉话见心 2020-12-23 11:39

Does anyone know why contentSize is not updated immediately after reloadData is called on UICollectionView?

If you need to know the contentSize the best work around

5条回答
  •  太阳男子
    2020-12-23 11:49

    In my case, I had a custom layout class that inherits UICollectionViewFlowLayout and set it only in the Interface Builder. I accidentally removed the class from the project but Xcode didn't give me any error, and the contentSize of the collection view returned always zero.

    I put back the class and it started working again.

提交回复
热议问题