0

I have created UICollectionView with auto sizing functionality.I have passed width and height 1 in estimated size of flow layout and seems to working fine. But when i load more and pull to refresh it will called crash with

2012-12-16 13:17:59.789 [16807:19703] *** Assertion failure in -[UICollectionViewData indexPathForItemAtGlobalIndex:],

Here is my code of estimated size

if let flowLayout = objCollectionView.collectionViewLayout as? UICollectionViewFlowLayout {

            flowLayout.estimatedItemSize = CGSize(width: 1.0,height: 1.0)
}
Chirag Shah
  • 3,034
  • 1
  • 30
  • 61
  • I don't think the error comes from this method but I think you are adding / refreshing your array of data while you try to display it. Or you change value of datta in background thread while `reloadData()` is in progress – Maxime Aug 02 '17 at 13:39
  • @Maxime i have debug three and four time and got 16 data in model and cell is only 10. it will not load new 6 cell – Chirag Shah Aug 02 '17 at 13:53
  • Do you reuse the same `FlowLayout` on multiple `CollectionView` in the same `ViewController`? – Maxime Aug 02 '17 at 14:15
  • @Maxime no i have one collection view in view controller which has 2 section – Chirag Shah Aug 02 '17 at 14:22
  • Did you take a look at this suggestion? https://stackoverflow.com/a/18411860/2678558 – Maxime Aug 02 '17 at 14:32

0 Answers0