Search code examples
iphoneiosipaduitableviewreloaddata

iPhone / iPad Table View Reload Only One Row Instead Of The Entire Table


Instead of a

[table reloadData]

Is there a way to tell the table to reload just one row? There are reasons for my madness.


Solution

  • It's in the docs. The method is called reloadRowsAtIndexPaths:withRowAnimation:. So you'd do something like:

    NSArray *indexPaths = [NSArray arrayWithObjects:
                           [NSIndexPath indexPathForRow:5 inSection:2],
                           // Add some more index paths if you want here
                           nil];
    [tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation: UITableViewRowAnimationFade];