删除行和tableView时崩溃

时间:2014-03-26 13:55:22

标签: objective-c uitableview

尝试使用以下内容删除tableview中的行时

 [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:swipedIndexPath, nil] withRowAnimation:UITableViewRowAnimationFade];

当indexPath有效且给出正确的单元格时,我收到此崩溃日志:

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-2903.23/UITableView.m:1330

不知道为什么?

1 个答案:

答案 0 :(得分:0)

请检查您的

(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

返回的值比调用' deleteRows之前的值少1 ..'

这可能是你的问题。如果要从tableview UI中删除一行,则后端数据也应删除它。