Edit Button on Navigation Controller does not enter edit mode
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)edi开发者_开发问答ting 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.
I think self.editButtonItem
is only supposed to work automatically like that in UINavigationControllers, not toolbars. As in self.navigationItem.rightButton = self.editButton;
精彩评论