Reloading only one UITableViewCell on a UITableview

Ok Guys, here’s the situation I have.

I’m using a UITableViewController with Core Data. The table has about 200 cells, that basically function as a checklist. When you tap a cell, that cell has a checkbox that gets toggled set to the UITableViewCell.imageView ( the UIImageView assigned to the left of the label).

  • connect button to TableViewController in xcode
  • UIButton inside UITableViewController
  • iOS UITableView contentOffset when keyboard is shown
  • UITableView does not automatically deselect the selected row when the table re-appears
  • Grouped UITableView has 20px of extra padding at the bottom
  • UITableView :cellForRowAtIndexPath Continues being called
  • Anytime I use either of the two ways below to update the table, it takes about 1 – 2 seconds for the update … and from what I can tell, it seems to be reloading every cell. How can I force only the cell that was just tapped to be updated?

    [self.tableView reloadData]; or

    - (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
        [self.tableView beginUpdates];
    }
    
    - (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
               atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type {
    
        switch(type) {
            case NSFetchedResultsChangeInsert:
                [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex]
                              withRowAnimation:NO];
                break;
    
            case NSFetchedResultsChangeDelete:
                [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex]
                              withRowAnimation:NO];
                break;
        }
    }
    
    - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
           atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
          newIndexPath:(NSIndexPath *)newIndexPath {
    
        UITableView *tableView = self.tableView;
    
        switch(type) {
    
            case NSFetchedResultsChangeInsert:
                [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]
                                 withRowAnimation:NO];
                break;
    
            case NSFetchedResultsChangeDelete:
                [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                                 withRowAnimation:NO];
                break;
    
            case NSFetchedResultsChangeUpdate:
                [self configureCell:[tableView cellForRowAtIndexPath:indexPath]
                        atIndexPath:indexPath];
                break;
    
            case NSFetchedResultsChangeMove:
                [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                                 withRowAnimation:NO];
                [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]
                                 withRowAnimation:NO];
                break;
        }
    }
    
    - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
        [self.tableView endUpdates];
    }
    

    2 Solutions Collect From Internet About “Reloading only one UITableViewCell on a UITableview”

    You need this:

    - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
    

    http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006943-CH3-SW40

    If you’re just updating the cell’s textlabel text- this code is enough

        UITableViewCell *cell = [_myTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
    
        cell.textLabel.text = [NSString stringWithFormat:@"%i", (int)_targetMaxDistanceSlider.value];