We have answer of your question!

100% solved queries, no empty question

0

Advertisement


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];
Question author Peter-warbo | Source

Answer


1


Advertisement


I think there is a problem in the UITableview update; you are loading the section 1 table while section 0 is getting reloaded. I would suggest you use the [tableview beginUpdates] and [tableview endUpdates] methods right before and right after reloading, and the problem should disappear.

If not, then tell me. Hope this helps.

Answer author Ieinstein

Advertisement


Tickanswer.com is providing the only single recommended solution of the question UITableView reload sections order matters? under the categories i.e ios , objective-c , cocoa-touch , uitableview , . Our team of experts filter the best solution for you.

Related Search Queries:

You may also add your answer!