I’m working in Objective C. I have a UITableViewController with about 25 cells that push to a UIViewController. When the user hits back, I want to see if the user entered the correct data for the given cell. (I have a working bool , we’ll call it isCellComplete for now). If isCellComplete is true, I want to add a checkmark as the accessory to the cell. I’ve been trying to put the test in cellForRowAtIndexPath but that method does not seem to run and refresh the cells everytime the view appears. Anyone have suggestions?
I’m working in Objective C. I have a UITableViewController with about 25 cells that
Share
You should look into the
UITableViewmethodreloadRowsAtIndexPaths:withRowAnimation:. This is much more elegant than reloading the whole table view. And if you don’t want an animation, you can specifyUITableViewRowAnimationNoneand it will look just likereloadDatabut be much more efficient.You should do the check in
tableView:cellForRowAtIndexPath:and if the check passes, set the cell’s accessory toUITableViewCellAccessoryCheckmark. Then when you tell the table view to reload the appropriate row(s), it’ll automatically calltableView:cellForRowAtIndexPath:on the data source and update that cell.