Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

UICollectionView images in photobomber loading to late

ad

3 Answers

Stone Preston
Stone Preston
42,016 Points

if the images are jumping only the first time you view the image, then thats the intended behavior and the way its normally done. when the user first views the collection view, only the visible cells are downloaded and then cached. downloading ALL of the the pictures at once even if the user hasnt scrolled down wastes memory and time. (a lot of the times the user isnt even going to scroll all the way through the images, there is no need to get all of them first) so the first time the cell is viewed it downloads the image, the next time its viewed the image is already in the cache so its just loaded from there (no download required).

if you look at an app like instagram or something and view a users photos you will see that the first time you start scrolling through the images some of them will be blank while they download. once they download you can scroll up and down and they will be loaded from the cache instead of from the server.

However if its doing it every single time then you may have an issue with your caching code

Thank you for the answer. I understand that this is intended and connected with easy loading.

But is it possible to download and load let say one more picture below the screen? It would make the initial scrolling more fluent, without 'jumping pictures'.

*lazy loading