Enjoy the animation while adding cells.
Add cells one at a time (one at a time) to your UITableView( and data source) by doing the following:
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
Yours UITableViewwill grow slowly with animation as the data becomes available.
If you need to resize an existing cell , delete it and reinsert it immediately, all within the same sequence beginUpdates / endUpdates:
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationFade];
[self.tableView insertRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
source
share