简体   繁体   English

UITableview编辑:“完成”按钮不执行任何操作

[英]UITableview editing: done button does nothing

My table is populated with data from a sql DB. 我的表中填充了来自sql DB的数据。 When I click on edit I can delete rows and the entry in the DB, but when I click on Done nothing happens. 单击“编辑”时,可以删除数据库中的行和条目,但是单击“完成”时,什么也不会发生。

To implement deleting I use commitEditingStyle: 要实现删除,我使用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];
}   

} }

I have another table in this app and Edit/Done works fine. 我在此应用中有另一个表格,“编辑/完成”工作正常。

The table with editing working is the first table showed when app starts, the non working table is called clicking on second item of a tabbar. 具有编辑功能的表是应用启动时显示的第一个表,非工作表称为单击选项卡栏的第二项。

Any help is appreciated. 任何帮助表示赞赏。

Thanks, Max 谢谢,马克斯

检查是否正确设置了委托。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM