小编Kil*_*Ice的帖子

滑动即可删除UITableView

如何在滑动时删除UITableView行?我知道问题已被提出,但我只得到错误.这是代码:

-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
    forRowAtIndexPath:(NSIndexPath *)indexPath {
    // If row is deleted, remove it from the list.
    if (editingStyle == UITableViewCellEditingStyleDelete) {
         NSInteger row = [indexPath row];
         [tableDataSource removeObjectAtIndex:row];      
    }
}
Run Code Online (Sandbox Code Playgroud)

但没有任何反应.如果你编写代码,我将不胜感激.

iphone uitableview ios

8
推荐指数
2
解决办法
8855
查看次数

标签 统计

ios ×1

iphone ×1

uitableview ×1