实现滑动删除,动态增加,以及cell的多选只需要添加cell 的三个代理函数。
1.这个函数是判断每一个cell是否可编辑
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
2.这个函数是返回编辑的类型
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
3.这个函数是编辑后的操作。但是多选例外。需要借助selected函数
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
废话不多说,直接上代码。。清晰明了
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor redColor];
self.tableView = [[UITableView