简体   繁体   中英

Place Images out of NSMutableArray on UIView?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM