Roman Siro Roman Siro - 1 month ago 194
Swift Question

UICollectionView cellForItemAt indexPath is skipping row indexes in iOS 10

I have

UICollectionView
with horizontal scrolling and paging. When I scroll to next or previous page for the first time or change scrolling direction from left to right, value of indexPath.row in
cellForItemAtIndexPath
is changing by 3 not 1. Then it works properly.
CollectionView
works without problems in
iOS
9. The problem occurs just in
iOS
10. Thanks.

Answer

Problem was with new prefetching feature of UICollectionView. Disabling of prefetching solved my problem.

if #available(iOS 10.0, *) {collectionView.isPrefetchingEnabled = false}