views:

37

answers:

1

I have a UIToolbar with an edit bar button on it. This is defined as

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

The edit bar item shows up, and but when i tap it, nothing happens, it does not change to Done and none of the editing controls show up.

I have implemented the following methods as i would like to be able to tap a cell and display a view to edit that cell's 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 is causing the edit button to function incorrectly?

Thanks.

A: 

I think self.editButtonItem is only supposed to work automatically like that in UINavigationControllers, not toolbars. As in self.navigationItem.rightButton = self.editButton;

Nimrod
OK, thanks.So i created a separate button. Now my minus buttons appear. Is it possible to detect the taps on the row though? I would like to be able to edit the items in the table view, and currently in editing mode, `didSelectRowAtIndexPath` is not called. Thanks.
joec
Check out the documentation for UITableViewCell property editingAccessoryType
Nimrod
Got it thanks...
joec