Josh O'Connor
Josh O'Connor

Reputation: 4962

Best practice for retrieving many images from Parse?

I have an app which is photo-based, and had a ton of large-scaled resolution images on Parse. I currently have my app set up to grab these images from Parse with a query, and storing each photo into an UIImage array with a loop, and then displaying these photos in a UICollectionView.

It works great, if we are pulling less than 10 photos from Parse. However, if I am retrieving, say 20 photos, when I scroll down my UICollectonView after the photos have been loaded, around the 18th or so photo, my app will crash, and Xcodes console will output "Received memory warning".

What is the best practice for retrieving a large amount of large sized photos from Parse? (If you are displaying them in a UICollectionView)

Upvotes: 3

Views: 312

Answers (1)

Mark
Mark

Reputation: 12535

I would download only the thumbnails. You can even do this using lazy loading (http://www.theappguruz.com/blog/ios-lazy-loading-images) if so inclined.

When the image is clicked on and you want to see it full size, then you download the full size image :) Set a limit on how many images you want to retain in memory, and use a queue to decide when to store/get rid of the old images.

Upvotes: 1

Related Questions