美文网首页
iOS tableView 可删除提交编辑笔记

iOS tableView 可删除提交编辑笔记

作者: 赵永洪 | 来源:发表于2015-12-18 09:17 被阅读445次

//是否可以编辑

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {

return YES;

}

//编辑样式

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {

return UITableViewCellEditingStyleDelete;

}

//提交编辑

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

if (editingStyle == UITableViewCellEditingStyleDelete) {

[self.tableViewArr removeObjectAtIndex:indexPath.row];

[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];

}

}

相关文章

网友评论

      本文标题:iOS tableView 可删除提交编辑笔记

      本文链接:https://www.haomeiwen.com/subject/druphttx.html