i'm programmatically adding a couple UIButtons to my view. After clicking one of the buttons they all should be 'removeFromSuperView' or released, not just one.
for (int p=0; p<[array count]; p++) {
button = [[UIButton alloc] initWithFrame:CGRectMake(100,100,44,44)];
button.tag = p;
[button setBackgroundImage:[UIImage imageNamed:@"image.png"] forState:UIControlStateNormal];
[self.view addSubview:button];
[button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
}
Now this is the part where all buttons should be removed. Not just one.
-(void) action:(id)sender{
UIButton *button = (UIButton *)sender;
int pressed = button.tag;
[button removeFromSuperview];
}
I hope someone can help me with this one!