允许转载,但附上点击打开链接
<span style="font-family:Menlo;color:#fcfb00;"><span style="font-size: 24px;"> </span></span>[tableView addNibWithEntity:数据对象 andCellName:@"cell的文件名字" editStyle:UITableViewCellEditingStyleDelete];
加进去的代码只有一句,操作删除功能的代码,也在cell里面写,cell继承commoncell
-(void)commonTableView:(CommonTableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[tableView removeIndexPath:indexPath withRowAnimation:UITableViewRowAnimationFade];
//xxxxxxx,这里按你的需要补上你的代码,例如删除本地数据库的缓存之类的
}
}
如图:(删除模式)
完!下一篇讲怎么添加字母索引CommonTableview