我想從委託方法外部的UITableview中刪除一行。我在單擊表格單元格內的按鈕並嘗試刪除該方法內部的行時調用方法。 這裏是我使用從UITableView刪除行外部TableView委託
UIButton *btn = (UIButton*)sender;
int tag = btn.tag;
UITableViewCell *buttonCell = (UITableViewCell*)[[btn superview] superview];
NSIndexPath *indexPath = [self.msgTbl indexPathForCell:buttonCell];
[deleg.rmessages removeObjectAtIndex:buttonRow];
[self.msgTbl deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop];NSInteger buttonRow = indexPath.row;
[self.msgTbl reloadData];
使用這一個或兩行被刪除,但之後它的崩潰給異常之前和之後的行
號碼刪除必須是同一個功能
我該如何在iOS中執行此操作? 謝謝
+1 - 當出現問題並且我的數據源實際上並未刪除該項目時,我得到了該異常,然後當調用reloaddata時,表中的項目數量與我的數據源中的項目數量不一致。 – bryanmac