2014-03-26 90 views
-2

時,當試圖刪除行中實現代碼如下搭配:崩潰刪除行的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

您是否更新了數據源以刪除該對象?你應該將數據源的刪除和更新包裝在tableView方法'beginUpdates'和'endUpdates'中 –

回答

0

請檢查您

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

返回一個值1小於之前調用的「deleteRows ..」

這可能是你的問題。如果你從tableview UI刪除一行,你的後端數據也應該刪除它。