refreshObject:mergeChanges for all instances of NSManagedObject in UITableView

Discussion in 'iOS Programming' started by mdhansen5, Aug 8, 2012.

  1. macrumors member

    Nov 22, 2010
    I'm using refreshObject:mergeChanges to refresh NSManagedObject "Task" in my UITableView. It works like it should, but I can only get it to refresh a single instance or cell at a time in my UITableView. What I want to be able to do is to use a single method (ex: refreshTasks) to to refresh everything at once.

    in my .h file:

    @property (strong, nonatomic) Task *selectedTask;
    in my .m:

    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
    self.selectedTask = [self.fetchedResultsController objectAtIndexPath:indexPath];
    [self.managedObjectContext refreshObject:selectedTask mergeChanges:NO];

    Now I know I'm refreshing only the selected "Task" but does anyone know how I could either get the indexPath for all of the items in the TableView, or to refresh everything at once?

    Any help would be really appreciated. Thank you so much!

Share This Page