title: How to make UIButton appear in last cell only?
body: <p>I am fairly new to Objective C programming, and have a UITableView setup with a custom cell. I want to make it so a user can touch a button that will add another cell, and this button will appear in the last cell only. Currently, it is not showing up. Here is the code that I am using. I have created the button within the custom cell, and used "setHidden:YES" to hide it within the cell itself. I am trying "setHidden:NO" to make the button appear in the TableView code, but it is not working. I thought maybe it had something to do with reloading the cell, but I am not sure if I am going in the right direction with this or not. I would appreciate any help on this, thanks.</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {workoutTableViewCell *cell = (workoutTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
  // Configure the cell...
  if (cell == nil) {
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  }
  [cell.addButton setTitle:(NSString *)indexPath forState:UIControlStateApplication];
  [cell.textLabel setText:[NSString stringWithFormat:@"Row %i in Section %i", [indexPath row], [indexPath section]]];
  
  NSInteger sectionsAmount = [tableView numberOfSections];
  NSInteger rowsAmount = [tableView numberOfRowsInSection:[indexPath section]];
  
  if ([indexPath section] == sectionsAmount - 1 &amp;&amp; [indexPath row] == rowsAmount - 1) {
      NSLog(@"Reached last cell");
      [cell.addButton setHidden:NO];
      if (lc == NO)
      {[[self tableView] reloadData];
          lc = YES;
      }
  }
  
   return cell;
   }
  </code></pre>