我正在尝试从委托方法之外的 UITableview 中删除一行。当我单击表格单元格内的按钮并尝试删除该方法内的行时,我正在调用一个方法。这是我正在使用的功能
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中做到这一点?谢谢