I have a for-loop. Inside that loop I want to fill up an NSArray with some objects. But I dont see any method that would let me do that. I know in advance how many objects there are. I want to avoid an NSMutableArray, since some people told me that's a very big overhead and performance-brake compared to NSArray.
I've got something like this:
NSArray *returnArray = [[NSArray alloc] init];
for (imageName in imageArray) {
UIImage *image = [UIImage imageNamed:imageName];
//now, here I'd like to add that image to the array...
}
I looked in the doc for NSArray but couldn't see something that lets me specify how many elements are going to be in there... any idea? Or must I really use NSMutableArray for that?