I have a ViewController with CollectionView inside. When the image is loaded, the visible cells (9 cells) are displayed correctly. When I scroll down, I want to load the visible elements in the collection using loadImagesForOnscreenRows by calling indexPathsForVisibleItems on partnerCollectionView. But when loadImagesForOnscreenRows indexPathsForVisibleItems always has the first 9 cells in it, even if cells 10 through 18 should be visible on the screen. The code I'm using is:
And this output result:
Initial display of visible items
2013-09-02 06:45:21.940 [2564:c07] startDownload:0 2013-09-02 06:45:21.943 [2564:c07] imageLoaderDidFinishDownloading:0 2013-09-02 06:45:21.950 [2564:c07] startDownload:1 2013-09-02 06:45:21.951 [2564:c07] imageLoaderDidFinishDownloading:1 2013-09-02 06:45:21.958 [2564:c07] startDownload:2 2013-09-02 06:45:21.959 [2564:c07] imageLoaderDidFinishDownloading:2 2013-09-02 06:45:21.965 [2564:c07] startDownload:3 2013-09-02 06:45:22.063 [2564:c07] imageLoaderDidFinishDownloading:3 2013-09-02 06:45:22.072 [2564:c07] startDownload:4 2013-09-02 06:45:22.073 [2564:c07] imageLoaderDidFinishDownloading:4 2013-09-02 06:45:22.081 [2564:c07] startDownload:5 2013-09-02 06:45:22.082 [2564:c07] imageLoaderDidFinishDownloading:5 2013-09-02 06:45:22.089 [2564:c07] startDownload:6 2013-09-02 06:45:22.090 [2564:c07] imageLoaderDidFinishDownloading:6 2013-09-02 06:45:22.098 [2564:c07] startDownload:7 2013-09-02 06:45:22.099 [2564:c07] imageLoaderDidFinishDownloading:7 2013-09-02 06:45:22.104 [2564:c07] startDownload:8 2013-09-02 06:45:22.163 [2564:c07] imageLoaderDidFinishDownloading:8
After scrolling to paragraph 10-19:
2013-09-02 06:45:26.212 [2564:c07] loadImagesForOnscreenRows1:8 2013-09-02 06:45:26.212 [2564:c07] loadImagesForOnscreenRows1:0 2013-09-02 06:45:26.212 [2564:c07] loadImagesForOnscreenRows1:1 2013-09-02 06:45:26.212 [2564:c07] loadImagesForOnscreenRows1:6 2013-09-02 06:45:26.213 [2564:c07] loadImagesForOnscreenRows1:2 2013-09-02 06:45:26.213 [2564:c07] loadImagesForOnscreenRows1:3 2013-09-02 06:45:26.213 [2564:c07] loadImagesForOnscreenRows1:4 2013-09-02 06:45:26.213 [2564:c07] loadImagesForOnscreenRows1:5 2013-09-02 06:45:26.213 [2564:c07] loadImagesForOnscreenRows1:7 2013-09-02 06:45:26.214 [2564:c07] loadImagesForOnscreenRows2:8 2013-09-02 06:45:26.214 [2564:c07] loadImagesForOnscreenRows2:0 2013-09-02 06:45:26.214 [2564:c07] loadImagesForOnscreenRows2:1 2013-09-02 06:45:26.214 [2564:c07] loadImagesForOnscreenRows2:6 2013-09-02 06:45:26.214 [2564:c07] loadImagesForOnscreenRows2:2 2013-09-02 06:45:26.215 [2564:c07] loadImagesForOnscreenRows2:3 2013-09-02 06:45:26.215 [2564:c07] loadImagesForOnscreenRows2:4 2013-09-02 06:45:26.215 [2564:c07] loadImagesForOnscreenRows2:5 2013-09-02 06:45:26.215 [2564:c07] loadImagesForOnscreenRows2:7
As you can see after scrolling, the objects, the visible index paths, remain unchanged. Has anyone else come across this or an idea for a solution? Or do I not know some principle of data collection?
Thank you very much in advance! Regards, Yang
ios uicollectionview nsindexpath
Jan stulens
source share