Search code examples
iphoneiosios6

How do I save memory when loading images from a URL in a Collection View?


I have a collection view in my app and want to load images from a url. The collection view is scrollable. If the user scrolls down more images should be paginated from the url.

What should I do with the images that I have loaded so far? One way would be to set the pointer to nil in order to free the space in the heap. But then I have to load then again, when the user scrolls up.

Is there a better way to handle the scrolling and keep the heap memory as low as possible?


Solution

  • Use library like SDWebImage or HJCache which offers asynchronous download and memory and file caching features.