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.
Problem was with new prefetching feature of UICollectionView. Disabling of prefetching solved my problem.
if #available(iOS 10.0, *) {collectionView.isPrefetchingEnabled = false}
Possible Case:
Since you're using paging in your collectionView, and as your declaration, 1 page contains 3 cells. So if you move 1 page, the index of cell will move by 3 because the index the taking from the cell at the left.
E.g. Cell > Page 1:[0..1..2] Page 2:[3..4..5]
来源:https://stackoverflow.com/questions/39871316/uicollectionview-cellforitemat-indexpath-is-skipping-row-indexes-in-ios-10