Invalid update: invalid number of items on UICollectionView

前端 未结 7 727
攒了一身酷
攒了一身酷 2020-12-07 21:07

I am stumped on this. Here is my scenario. In my Appdelegate, I am creating

  1. An instance of a view controller that will be presented modally to collect two pi
相关标签:
7条回答
  • 2020-12-07 21:31

    In my case, numberOfItemsInSection was being called twice from self.performBatchUpdates (once for the BEFORE number, once for the AFTER number) because I was trying to insert something into the collectionView before the view controller had finished loading.

    The solution is to add guard isViewLoaded else { return } before calling self.performBatchUpdates.

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