The edit button on the navigation controller does not enter edit mode

I have a UIToolbar with an edit panel button. It is defined as

self.toolbarItems = [NSArray arrayWithObjects:self.editButtonItem,nil];

An element of the editing panel is displayed, but when I click it, nothing happens, it does not change to "Finish", and none of the editing controls appears.

I have implemented the following methods since I would like to be able to click on a cell and display a view to edit this cell value.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.editing) {
        NSLog(@"editing ON in didSelect...");
    }else{
        [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
    }
}

- (void)setEditing:(BOOL)editing animated:(BOOL)animate {
    if (editing) {
        NSLog(@"editing ON in setEditing");
    }else {
        NSLog(@"not editing in setEditing");
    }

}

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

What causes the edit button to malfunction?

Thank.

+3
source share
1 answer

, self.editButtonItem UINavigationControllers, . self.navigationItem.rightButton = self.editButton;

+2

Source: https://habr.com/ru/post/1769433/


All Articles