title: Edit Item in Bottom Toolbar Xcode and Objective C
body: <p>I have a Navigation Controller. I want to put the edit button on the bottom in the toolbar instead of in the top navigation bar.</p>
  
  <pre><code> self.navigationItem.leftBarButtonItem = self.editButtonItem;
  </code></pre>
  
  <p>The problem I have is that when I add the edit button to the Bottom Toolbar. like this:</p>
  
  <pre><code> - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  {
  if (editingStyle == UITableViewCellEditingStyleDelete) {
      // Delete the row from the data source
      [self.christmasGifts removeGiftAtIndexPath:indexPath];
      [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
  }   
  }
  
  - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
  
  [super setEditing:editing animated:animated];
  [self.tableView setEditing:editing animated:YES];
  
  //Do not let the user add if the app is in edit mode.
  if(editing)
      self.navigationItem.rightBarButtonItem.enabled = YES;
  else
      self.navigationItem.rightBarButtonItem.enabled = YES;
   }
  </code></pre>
  
  <p>And then link the edit button setEditing: in the toolbar it does not show a done button like the Edit button in the top navigation. it just stays the same.</p>
  
  <p>But you can delete an item, but you cannot reset the state to normal again with the bottom button.</p>
  
  <p>I need to be able to go back to the previous controller from this Navigation Controller. but the edit button hides the back button.</p>
  
  <p><img src="https://i.stack.imgur.com/xPJpM.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/xc0kZ.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/bXYuu.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/MEOFN.png" alt="enter image description here"></p>
  
  <p>Edit.</p>
  
  <p>I know I can by code add the toolbar.</p>
  
  <pre><code>UIBarButtonItem *editButton = [[UIBarButtonItem alloc]
                             initWithTitle:@"Edit"
                             style:UIBarButtonItemStyleBordered
                             target:self
                             action:@selector(setEditing:)];
  
  [[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:70/255.0f green:155/255.0f blue:19/255.0f alpha:1.0]];
  
  NSArray *arrBtns = [[NSArray alloc]initWithObjects:editButton,anotherButton, nil];
  self.toolbarItems = arrBtns;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>[self.navigationController setToolbarHidden:NO];
  </code></pre>
  
  <p>or even</p>
  
  <pre><code>  UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 500, 400, 40)];
    [self.tableView addSubview:toolBar];
  </code></pre>