Is there a more elegant solution for this question?
I have about 70 .png images I want to load and randomly pull from an array when a button is pressed. (Up to 50 images could be on screen at once and each is 40-68kbs in size with dimensions of 150X215, obviously there will be over lap and covered images behind foreground images at times) Should I use the following example to pull that off?
EXAMPLE:
-(void)viewDidLoad {
UIImage *dogImage = [UIImage imageNamed: @"dog.png"];
UIImage *catImage = [UIImage imageNamed: @"cat.png"];
// And so on 68 more times followed by....
for (int i = 1; i <= 70; i++) {
UIImageView *dogView = [[UIImageView alloc]initWithImage:dogImage];
UIImageView *catView = [[UIImageView alloc]initWithImage:catImage];
// And so on 68 more times followed by....
NSArray *animalArray = [[NSArray alloc] initWithObjects: dogView, catView, nil];
// And so on 68 more times ending the array with ,nil
// other code and and release calls, etc...
}
}
Is this fine for performance or am I going to crash the app at launch or soon after? The
Anyone alternatives to doing it this way?