Reputation: 127
I have got 6 NSMutableArray(monday,tuesday...saturday) which I add to NSMutableArray "day" I doing in this method " numberOfRowsInSection "
NSArray *array = [day objectAtIndex:section];
return [array count];
all work, but when I add item I have item only when I rebuild project or if I delete a row I have got error
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 I doing this method everything works but i need doing the first method, in two-three lines
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];
Upvotes: 0
Views: 422
Reputation: 243
you must remove object in your array when you delete tableview cell. if you remove cell at section one row one,you should:
[[day objectAtIndex:one] removeObjectAtIndex:one];
Upvotes: 1