If you only want to reload the selected cell, override viewWillAppear: in your custom UITableViewController subclass like this:
- (void)viewWillAppear:(BOOL)animated { NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow]; [super viewWillAppear:animated];
NOTE. Assuming you left clearsSelectionOnViewWillAppear on YES (the default), you should get the path to the specified column before calling super , which will clear the selection.
Additionally, @ZoranSimic's solution for calling [self.tablView reloadData] acceptable, as it is smaller than code and still efficient.
Finally, perhaps the best way to keep your table view cells in sync with the model objects that they represent is to do it as an NSFetchedResultsController and use key value monitoring (KVO) and / or NSNotification to tell your table view when the model objects have changed, so that they can reload the corresponding cells. The table view controller can begin to observe the changes in its model objects in viewDidLoad and end the observation in dealloc (and anywhere you manually unload self.view ).
ma11hew28 Oct 15 '13 at 17:36 2013-10-15 17:36
source share