iOS 10 collectionView:prefetchItemsAt未调用 [英] iOS 10 collectionView:prefetchItemsAt not called
问题描述
我正在尝试使用 UICollectionViewDataSourcePrefetching
协议的新的 collectionView:prefetchItemsAt
和 collectionView:cancelPrefetchingForItemsAt
方法,但是没有一个被调用.通过接口构建器设置委托(从具有相同结果的代码中进行尝试),将部署目标设置为iOS 10,因此从理论上讲应该可以使用.所以我的问题是我是否为了使它起作用而缺少某些东西,或者该机制比我想象的更复杂,并且系统不认为它应该进行预取?
I am trying out the new collectionView:prefetchItemsAt
and collectionView:cancelPrefetchingForItemsAt
methods of the UICollectionViewDataSourcePrefetching
protocol, but neither of those are called. The delegate is set via interface builder (tried from code with the same result), deployment target is set to iOS 10, so in theory it should work. So my question is that am I missing something in order to make it work, or the mechanism is more sophisticated than I thought and the system doesn't felt that it should do the prefetching?
推荐答案
可能是您正在设置estimatedItemSize,在这种情况下可能不会调用预取.
来源:在一个迷你演示应用程序中进行了尝试.
It may be that you are setting the estimatedItemSize in which case prefetching may not be called.
Source: Tried it out in a mini demo app.
这篇关于iOS 10 collectionView:prefetchItemsAt未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!