Changing the title of Edit Button (LeftBarButton)


#1

I am trying to the change the title of LeftBarButton (This is similar to Bronze Challenge of Chapter10 modified)

Here is parts of my code in ItemsViewController.m. The title of the LeftBarButton has changed - However, tapping it doesn’t do anything. Any pointers?

-(id)init
{
    self = [super initWithStyle:UITableViewStyleGrouped];
    
    if (self) {
        UINavigationItem *n=[self navigationItem];
  
        // Changing the title of the LeftBarButton to Change
        //When ItemsViewController (self) is sent an action editButtonItem
        //it creates UIBarButtonItem
        
        UIBarButtonItem *lbi=[[UIBarButtonItem alloc] 
                               initWithTitle:@"Change" 
                               style:UIBarButtonItemStylePlain 
                              target:self 
                              action:@selector(editButtonItem)];
        [[self navigationItem] setLeftBarButtonItem:lbi];

    }
    return self;
}

I then override the setEditing:animated: method to respond to this message from the UIBarButton

- (void)setEditing:(BOOL)editing 
          animated:(BOOL)animated
{
    [super setEditing:editing animated];
    [[self tableView] setEditing:YES animated:YES]; 
    return;
}

#2

The selector needs to be @selector(toggleEditing:) and you need to implement the method - (void)toggleEditing:(id)sender;