I'm trying to understand why it seems to matter in what order I reload sections of my UITableView
If I reload like this:
// Reload section 1
[self.groupDetailsTableView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
// Reload section 0
[self.groupDetailsTableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
There is no issue, but if I reload in opposite order (section 0 first and then section 1) I get an error:
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 1. The number of rows contained in an existing section after the update (2) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
However If I do it like this, there is no error:
[self.groupDetailsTableView reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)] withRowAnimation:UITableViewRowAnimationFade];
reloadSectionsfor all sections with any changes at the same time. Either that or insert and remove rows as you go along. - Rob