views:

22

answers:

1

Hi,

I have an array of multiple images which I want to display on my screen (2 Columns, 4 Rows). If there are more than 8 Images in the row, than a new view should be created. Can someone please point me in the correct direction how to handle this?

Thanks for any feedback!

BR,

Stefan

A: 

This is a very generic question. Have you consider keeping your model in the app delegate which stores the full instance of the NSMutableArray. And then create a convenience method in your model that will query for up to 8 images from a particular index?

Your UIViewController should then be initialized with a particular index and access the model to get up to 8 images back from the model, returned in an NSArray. And your UIViewController can then display up to those 8 images, checking the size of the NSArray returned.

Also you might want to consider just storing an Array of NSURLs to these images and load them only when that particular UIViewController gets those arrays. This will limit your memory footprint by a whole lot.

Hope that helps.

Shiun
Hi, I have the images in a NSMutableArray populated from a database inside my app! I don´t get the link where to put the imageviews! I now I need to use a "For Loop", because I now the number of entries in the NSMutable ARray! I just don´t get it how to handle the positions of the UIImageViews and how to fill them with the Images from the array... Thanks, Stefan