您的位置:首页 > 产品设计 > UI/UE

UITableView的cell表格刷新(增加,删除,修改)

2016-06-01 16:16 519 查看
摘要: 有了前面几篇博客的基础,今天进行增加,删除,修改一些操作。

UITableView删除

1.删除步骤(add,update are the same)

删除对应行模型数据

让tableView重新加载数据源

2.具体代码(按标题1的步骤来写代码)

删除对应行模型数据



-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
[self.tuangous removeObjectAtIndex:indexPath.row];
[tableView reloadData];
}

* 让tableView重新加载数据源

```objc
-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
[self.tuangous removeObjectAtIndex:indexPath.row];
[tableView reloadData];
}

3.代码地址

左滑删除github

批量删除github代码

增加,修改,删除功能全了 github
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息