I found a solution to my problem.
You should add a object level BOOL flag called editPressed.
It should be set to NO in viewDidLoad.
When making each cell, add a button to each and set it to hidden if need be:
[button setHidden:!editPressed];
It is important to use the flag so that when new cells are made they will keep the buttons hidden if they should be or visible otherwise.
Then have a object level NSMutableArray *
of the buttons in the view controller and add each button to it:
[buttons addObject:button];
When you want to show each button, just change the hidden state:
editPressed = YES;
for(int i = 0; i != [butttons count]; i++){
[[buttons objectAtIndex:i] setHidden:!editPressed];
}
When you want to hide each button, once again, change the hidden state:
editPressed = NO;
for(int i = 0; i != [butttons count]; i++){
[[buttons objectAtIndex:i] setHidden:!editPressed];
}