title: Objective c - Deleting rows of a table view
body: <p>it's my first question in this awesome site. I've really searched a lot and yet find an answer to the next problem.</p>
  
  <p>I have a table view with 9 cells. One of the cells has a switch button in it. When the switched button value changes, i want to delete 2 rows of the table view. I have written the next code: </p>
  
  <pre><code>- (IBAction)switchValueChanged:(id)sender {
  NSLog(@"%@", ([switch isOn]) ? @"ON" : @"OFF"); 
  
  NSArray *deleteIndexPaths = [NSArray arrayWithObjects:
                               [NSIndexPath indexPathForRow:1 inSection:0],
                               [NSIndexPath indexPathForRow:2 inSection:0],
                               nil];
  
  UITableView *tableView = (UITableView *)self.view;
  
  [tableView beginUpdates];
  
  [tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
  // I Have to change the number of rows in the section here.
  
  [tableView endUpdates];
  }
  </code></pre>
  
  <p>When i run this, I'm getting a problem relating to the number of rows in the section - this number has been changed so i need to change it. I really can't find how i change it, but i know where i have to change it (see code). </p>
  
  <p>How can i do it? how can i call the method <code>numberOfRowsInSection:NSInteger</code> and set also the rows? </p>
  
  <p>Thank you very much :)</p>