Use the following instance method of a UITableView :
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
You need to specify the NSArray of NSIndexPaths that you want to reload. If you just want to reboot. If you only want to reload a single cell, you can specify an NSArray that contains only NSIndexPath . For example:
NSIndexPath* rowToReload = [NSIndexPath indexPathForRow:3 inSection:0]; NSArray* rowsToReload = [NSArray arrayWithObjects:rowToReload, nil]; [myUITableView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];
You can see the UITableViewRowAnimation enumeration for all possible ways of animating row updates. If you do not need animation, you can use the value UITableViewRowAnimationNone , as in the example.
Rebooting certain lines has a greater advantage than just getting the animation effect you want. You also get a huge performance boost, because only those cells that you really need to reload have their data updated, repositioned, and redrawn. Depending on the complexity of your cells, each time you update a cell, there may be enough overhead, so narrowing down the number of updates you make is a necessary optimization that you should use whenever possible.
James Bedford Mar 24 2018-11-11T00: 00Z
source share