ios - (void)reloadSections:(NSIndexSet *)sections ...方法bug解决

*** 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 (1) must be equal to the number of rows contained in that section before the update (2), 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).’

推荐: http://blog.csdn.net/iosswift/article/details/50001145  好文章
数据源动态变化的情况下,例如在某些页面中,每个Section中的row是动态变化的,单独使用reloadSection会导致文中的bug。而使用reloadData不会出现这个bug。 而reloadSection相比reloadData多一点的是,在刷新的时候有动画。
更多情况下,是搭配beginUpdates和endUpdates来实现 deleteSections:withRowAnimation:的功能。

你可能感兴趣的:(ios - (void)reloadSections:(NSIndexSet *)sections ...方法bug解决)