Rather than creating an array of images where you list each image individually this will loop through images that all have the filename "frame-X.png" where X is a number from 1 to 20. So if you have a series of images "frame-1.png", "frame-2.png" this loop will create the array. Good for creating an image-based animation.
- //First, define how many images will be in your array
- //Just change to adjust to your own number of images
- #define IMAGE_COUNT 20
- //create an array to hold the images
- //build array of images, cycling through image names
- int i;
- for(i=1; i<IMAGE_COUNT; i++)
- [imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"frame-%d.png", i]]];
- //another short example:
- for (int c=0;c<300;c++)
- [UIImage imageNamed: imageName];
You need to login to post a comment.