我有 6 个 NSMutableArray(monday,tuesday...saturday),我将其添加到 NSMutableArray“day” 我在这个方法中做“numberOfRowsInSection”
NSArray *array = [day objectAtIndex:section];
return [array count];
所有工作,但是当我添加项目时,只有在重建项目或删除一行时我才会有项目
Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1448.89/UITableView.m:995
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.
The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted).
如果我执行此方法,一切正常,但我需要执行第一种方法,两三行
if(section==0)
return [monday count];
if(section==1)
return [tuesday count];
if(section==2)
return [wednesday count];
if(section==3)
return [thirsday count];
if(section==4)
return [friday count];
if(section==5)
return [saturday count];
最佳答案
删除表格 View 单元格时,必须删除数组中的对象。 如果您删除第一行第一节的单元格,您应该:
[[day objectAtIndex:one] removeObjectAtIndex:one];
关于iphone - UITableView numberOfRowsInSection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9128977/