I use 20 UIButtons in my application .i set the background image of all these UIButtons on click event.all these UIButton are save in NSMutableArray.here is code.
saveBtn = [[NSMutableArray alloc] init];
for (int i=0; i<20; i++) {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(spacex, spacey, 30.0, 30.0);
idx = arc4random()%[arr count];
NSString* titre1 = [arr objectAtIndex:idx];
[btn setTitle:titre1 forState:UIControlStateNormal];
spacex = spacex + 30;
[saveBtn addObject:btn];
[self.view addSubview:btn];
}
i don it successful here is my code.
UIButton *currentButton = (UIButton *)sender;
UIImage * imgNormal = [UIImage imageNamed:@"subtabButton.png"];
[currentButton setBackgroundImage:imgNormal forState:UIControlStateNormal];
[currentButton setTitle:currentButton.titleLabel.text forState:UIControlStateNormal];
But between these 20 UIButtons there are 3 UIButtons ,i want that when player click one of these three UIButtons,all the previous set background images are remove from UIButtons.can any one guide me how we can do it..thanx in advance.
or if you want to remove the image: