2011-03-27 84 views
0

我的表中填充了来自sql数据库的数据。当我点击编辑时,我可以删除行和数据库中的条目,但是当我点击完成时,什么也没有发生。UITableview编辑:完成按钮不执行任何操作

要实现删除我用commitEditingStyle:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 

if (editingStyle == UITableViewCellEditingStyleDelete) { 

    //Get the object to delete from the array 
    buddies *buddyObj = [appDelegate.buddiesArray objectAtIndex:indexPath.row]; 
    [appDelegate removeBuddy:buddyObj]; 

    //Delete the object from the table. 
    [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
    [self.tableView reloadData]; 
} 

}

我有另一台在此应用程序和编辑/完成工作正常。

带编辑工作的表格是应用程序启动时显示的第一张表格,非工作表格称为单击选项卡栏的第二项目。

任何帮助表示赞赏。

感谢, 最大

+0

您只发布的代码显示删除该行。处理编辑/完成按钮触摸事件的代码在哪里? – ssteinberg 2011-03-27 08:20:09

+0

我解决了。我设置了一个名为isEditing的BOOL,这是冲突的。重命名我的BOOL并解决。 – masgar 2011-03-27 11:42:06

回答

0

检查委托设置正确。

相关问题