Question

I had an array with 400 strings, each representing the name of an image. I have to show them as tiles like that in a gallery application. In the small version with 20 images, I used the following way.

  1. Downloaded the images asynchronously.
  2. Used ImageView+ScrollView combination and a for loop to add each imageview to the scrollview.

But I know it is not the right way when considering memory issues. How should I do this, any available frameworks? Also, how should I do it without using a framework?

Was it helpful?

Solution

As for the UI, the collection view is made for exactly that purpose.

This is an older but nice tutorial that tells you how to do that within a table view. However, you can simply adopt the same logic to the data source of a collection view.

http://www.markj.net/iphone-asynchronous-table-image/

(I learned it from that tutorial myself. But as I implemented my case well before the collection view as introduced by Apple, I simply displayd an array of image views in each table cell. Now that the collection view is available I would scrap my (rather complicated) solution and go for the collection instead, when ever I have a chance for refactoring my old app. )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top