title: table view edit mode
body: <p>I have a Navigation controller on which a table view is there. I wanted two button on that navigation bar i.e. "Add to Favourite" and the other is "Edit".</p>
  
  <p>Both the button should fire the event that makes the table view go in editing mode. From the "Add to favorite button i want the table view to go in insertion mode i.e. a +green sign in front of every cell and with the Edit button i want it to go in deletion mode i.e. - negative sign in front of every cell.</p>
  
  <p>I have sorted out the Edit button , but i am not able to do the Add to favorite button.
  Sticking my code here for reference</p>
  
  <p>The viewDidLoad method:</p>
  
  <pre><code>- (void)viewDidLoad
  {
  
        self.navigationItem.rightBarButtonItem = self.editButtonItem;
  
      self.navigationItem.leftBarButtonItem=[[[UIBarButtonItem alloc]initWithTitle:@"Add to Favourite" style:UIBarButtonItemStylePlain target:self action:@selector(saveAction:)]autorelease];
  
  
  
  
      [super viewDidLoad];
  
  
  
  
  - (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.leftBarButtonItem.enabled = NO;
      else
          self.navigationItem.leftBarButtonItem.enabled = YES;
  
  
      NSLog(@"i came till here");   }
  </code></pre>
  
  <p>In this method i am just retrieving values from database and deleting it from the DB as well as the table view.</p>
  
  <pre><code>- (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
  forRowAtIndexPath:(NSIndexPath *)indexPath {
  
      if(editingStyle == UITableViewCellEditingStyleDelete) {
  
          NSDictionary *rowVals = (NSDictionary *) [appdelegate.tablearr objectAtIndex:indexPath.row];
          NSString *keyValue = (NSString *) [rowVals objectForKey:@"id"];
  
        //  [tableView beginUpdates];
  
          sqlite3 *db;
          int dbrc; //Codice di ritorno del database (database return code)
          AppDelegate *appDelegate = (AppDelegate*) [UIApplication sharedApplication].delegate;
          const char *dbFilePathUTF8 = [appDelegate.dbFilePath UTF8String];
          dbrc = sqlite3_open(dbFilePathUTF8, &amp;db);
          if (dbrc) {
              NSLog(@"Impossibile aprire il Database!");
              return;
          }
  
          sqlite3_stmt *dbps; //Istruzione di preparazione del database
  
          NSString *deleteStatementsNS = [NSString stringWithFormat: @"DELETE FROM \"Hell\" WHERE id='%@'", keyValue];
          const char *deleteStatement = [deleteStatementsNS UTF8String];
          dbrc = sqlite3_prepare_v2(db, deleteStatement, -1, &amp;dbps, NULL);
          dbrc = sqlite3_step(dbps);
          sqlite3_finalize(dbps);
          sqlite3_close(db);
  
  
          [appdelegate.tablearr removeObjectAtIndex:indexPath.row];
  
  
  
          //Delete the object from the table.
          [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
  </code></pre>
  
  <p>And this is the one method thats get fired when i press the add to favorite button </p>
  
  <pre><code>-(void)saveAction:(UIBarButtonItem *)sender{
  
      NSLog(@"here");
  
  
  
   }
  </code></pre>
  
  <p>Now what should i write in this method so that the table view goes into the editing and with an + green insertion thing in front of every cell ??</p>