UICollectionView cellForItemAt indexPath在iOS 10中跳过行索引 [英] UICollectionView cellForItemAt indexPath is skipping row indexes in iOS 10

查看:92
本文介绍了UICollectionView cellForItemAt indexPath在iOS 10中跳过行索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 UICollectionView 以及水平滚动和分页功能.当我第一次滚动到下一页或上一页或从左向右更改滚动方向时, cellForItemAtIndexPath 中的indexPath.row的值更改为3而不是1.然后它可以正常工作. CollectionView iOS 9中可以正常工作.问题仅在 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.

推荐答案

问题是UICollectionView的新预取功能.禁用预取功能解决了我的问题.

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

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

这篇关于UICollectionView cellForItemAt indexPath在iOS 10中跳过行索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆