0

I have a UITableView with a custom cell. On the press of a button called Edit, I want a UIButton checkMarkBox to appear on all cells. So initially checkMarkBox is hidden, but when this IBAction method is called for Edit, I want the checkMarkBox to be unhidden. When I do this now, it only unhides the box for the last cell, not all of them. So I need a way to go through every cell in my table view and unhide the check box. I'm thinking some kind of for loop that goes through all the cells will do the trick, but I'm not sure how to get that started.

Snowman
  • 31,411
  • 46
  • 180
  • 303
  • I tried the for loop here, but it didn't do the trick: http://stackoverflow.com/questions/5644635/ipad-iterate-over-every-cell-in-a-uitableview – Snowman Aug 21 '11 at 17:10

1 Answers1

1

When the button is pressed, set a BOOL in an instance variable for your class. In cellForRowAtIndexPath, check that BOOL and show or hide the checkMarkBox. In the IBAction for your button, set the BOOL, and then call:

[self.tableView reloadData];
Nathanial Woolls
  • 5,231
  • 24
  • 32
  • Another question maybe you'll know a work around for: when the check box is selected, how can I send back the selected cell's index? – Snowman Aug 21 '11 at 17:18