iOS重新加载两个tableView部分

时间:2013-06-10 04:44:59

标签: ios tableview reload

如何在tableView中重新加载两个不相邻的部分?例如,如果我想重新加载0和4部分,我不能使用

[NSIndexSet indexSetWithIndexesInRange: withRowAnimation:];

因为它会重新加载其间的所有部分,对吗?

我也尝试过连续调用

[NSIndexSet indexSetWithIndex: withRowAnimation:]

但它没有用,我收到了这个错误:

*** 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 (8) 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).' 

编辑抱歉,我忘记在我的更新中提及重新加载的每个部分的行数更改。

1 个答案:

答案 0 :(得分:1)

我能够通过重新排序reloadSections来解决我的问题:调用以便在每次reloadSections:call之前只更改了一个部分的数据。