title: How to add Section and TableView Cell dynamically
body: <p>I have a button that when pressed, a tableview section will be added and will also add a new row to that section. How can I implement this programatically?</p>
  
  <p>I have an array of cells.</p>
  
  <p>Here are my codes</p>
  
  <pre><code>- (IBAction)addCell:(id)sender {
  
      UITableViewCell *newCell = [[UITableViewCell alloc] init];
  
      counter++;
      [cells addObject:newCell];
  
      [self.tableView reloadData];
  }
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
      return [cells count];
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
     return 1;
  }
  
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
        //this is where i want to adjust the row per section
        //this code hide the recent sections, only the current created section appears
        return [cells objectAtIndex:indexPath.row];
  }
  </code></pre>