contentSize is not updated after reloadData is called on UICollectionView

前端 未结 5 2001
醉话见心
醉话见心 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:57

    This worked for me:

    [self.collectionView.collectionViewLayout invalidateLayout];
    [self.collectionView.collectionViewLayout prepareLayout];
    

提交回复
热议问题