Code:
//pick one filename
int numFileNames = [imageArray count];
int chosen = arc4random() % numFileNames;
NSString *oneFilename = [imageArray objectAtIndex: chosen];
thanks!!
Code:
//pick one filename
int numFileNames = [imageArray count];
int chosen = arc4random() % numFileNames;
NSString *oneFilename = [imageArray objectAtIndex: chosen];
thanks!!
There's one error in your NSMutableArray:
You need to initialize it first.
NSMutableArray *imageArray = [[NSMutableArray alloc] init];
;)
and here's a suggestion, if you do not necessarily require the interface builder's assistance, you might want to consider cocos2d. The stuffs you wanted to do can be done easily in it.
-- as for step 3. Do a random pick using Rand(), make a loop to check if the selected image is already added in an array (this array is for picked images), if it's in the array randomize again, if not then add in into the picked array, and do ball1.image = [UIImage imageNamed:[imageArray objectatindex:randomNum]];