开发者

crash application in deleting tableview

I am using core data.开发者_运维知识库 When i delete row (in section there is only one row so indirectly i have to delete section), application is crash and i get following error:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 4. 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).'

I remove object from mutablearray, which i used to popupalate tableview data.Please help me.enter code here

I want to delete section. So i use this function

[self.tableview deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationTop];


did you delete the corresponding cell with something like this?

[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];


Be sure to first delete the section's objects from the data source and only then from the tableview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜