Проведите пальцем, чтобы удалить UITableView

Как удалить строку UITableView при смахивании? Я знаю, что вопрос задан, но получаю только ошибки. Вот код:

-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
    forRowAtIndexPath:(NSIndexPath *)indexPath {
    // If row is deleted, remove it from the list.
    if (editingStyle == UITableViewCellEditingStyleDelete) {
         NSInteger row = [indexPath row];
         [tableDataSource removeObjectAtIndex:row];      
    }
}

Но ничего не происходит. Буду признателен, если вы напишете код.

8
задан ROMANIA_engineer 8 September 2017 в 13:56
поделиться