UITableView iOS8 侧滑删除

UITableView iOS8 侧滑删除_第1张图片
TableView 侧滑删除
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
    //iOS 8 需要实现
}

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
        [self deleteCheckerHttpRequestWith:indexPath];
    }];
    deleteAction.backgroundColor = [UIColor redColor];
    UITableViewRowAction *editorAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"编辑" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {

    }];
    editorAction.backgroundColor = [UIColor blueColor];
    NSArray *arr = @[deleteAction,editorAction];
    return arr;
}

刷新列表

NSIndexSet * index = [NSIndexSet indexSetWithIndex:i];
[_tableView reloadSections:index withRowAnimation:UITableViewRowAnimationAutomatic];
[_tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

UITableView 相关

UITableView 索引详细

你可能感兴趣的:(UITableView iOS8 侧滑删除)