无法删除自定义表格视图单元格
问题描述:
在我的一个ViewControllers中,我添加了一个tableview作为子视图。无法删除自定义表格视图单元格
在这个tableView中我实现了自定义表格视图单元格。
因此,当我们按下删除按钮时,如何从tableView中删除自定义Table View Cell。
谁能帮我..
答
试试这个,
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[tableView beginUpdates];
[self.itemTable removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView endUpdates];
}