I recall doing such a thing with my test app. I had several balls falling down, and it would explode after a certain situation(which isn't the point)
When the user has filled the entire screen with balls or failed. I clear out the ballarrays
Here's the code that removes the array. BallArray contains UIViews.
Code:
for (int a=0; a<[BallArray count]; a++)
{
NSString *testtext2 = [[NSString alloc] initWithFormat:@"Failed~"];
test2.text=testtext2;
score=0;
[[BallArray objectAtIndex:a] removeFromSuperview];
[BallArray removeObjectAtIndex:a];
a--;
}
You have to do a loop because each UIView needs to remove from super view first.
By the way I don't think.
Code:
for (UIView *bomb in bigbombArray)
[bomb removeFromSuperview];
Is a legit statement.
Another method not sure if it saves a bit of time is this.
Code:
for (int a=0; a<[BallArray count]; a++)
{
NSString *testtext2 = [[NSString alloc] initWithFormat:@"Failed~"];
test2.text=testtext2;
score=0;
[[BallArray objectAtIndex:a] removeFromSuperview];
a--;
}[BallArray removeAllOBjects];
Just remember to replace BallArray with your array.
And just in case this info is needed, my BallArray is an NSMutableArray