title: Button added to custom section header view disappears when row is deleted
body: <p>Just came across some very strange behavior in my app. I've recreated the problem in a simplest-case scenario:</p>
  <pre><code>NSMutableArray *data;
  
  - (void)viewDidLoad {
      [super viewDidLoad];
      data = [[NSMutableArray arrayWithObjects:@&quot;1&quot;, @&quot;2&quot;, @&quot;3&quot;, nil] retain];
  }
  
  - (UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger)section { 
      UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, 32.0)];
      header.backgroundColor = [UIColor lightGrayColor];
      [header addSubview:self.button];
      return header;
  }
  
  - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
      if (editingStyle == UITableViewCellEditingStyleDelete) {    
          [data removeObjectAtIndex:indexPath.row];
          [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop];
      }
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
      return data.count;
  }
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
      cell.textLabel.text = [data objectAtIndex:indexPath.row];
      return cell;
  }
  
  - (void)dealloc {
      [super dealloc];
  }
  </code></pre>
  <p>Every time I delete a row; the button in my header disappears! This happens no matter what type of rowAnimation I use. If I scroll the table up so that the header scrolls off; the button returns when the header returns. The button is created in the xib file.</p>
  <p>I can work around it in one of 2 ways:</p>
  <ul>
  <li><p>Reloading the tableView data after the delete; with a delay so that the deletion animation completes first.</p>
  </li>
  <li><p>Creating the button in viewForHeaderInSection instead of in the interfaceBuilder.</p>
  <p>I'd really like to understand what's going on here. Where is the button going? I've confirmed that viewForHeaderInSection is called when I delete a row.</p>
  </li>
  </ul>
  <p><em>Edit</em> I tried changing it so that the button is created in viewForHeader, instead of in the xib, but it's causing other strange issues... when I create or delete the button, I am setting certain properties such as the title and enabled depending on how many items there are in the table. When I delete the last row in the table, I don't see the update in text and enabled status until I scroll the button off the screen and back on again.</p>