title: iOS UITableView showing section header programmatically
body: <p>I want to show a section header programmatically. Here's what I have.</p>
  
  <pre><code>- (void)refreshSectionHeader
  {
      [self.tableView beginUpdates];
      [self.tableView endUpdates];
  }
  </code></pre>
  
  <p>-</p>
  
  <pre><code>- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  {
      if ([self shouldShowSectionHeader]) {
  
          UILabel *label = [[UILabel alloc] init];
          label.backgroundColor = [UIColor whiteColor];
          label.font = [label.font fontWithSize:15];
          label.text = @"It'sa me! Mario!";
          label.textAlignment = NSTextAlignmentCenter;
  
          return label;
  
      } else {
          return nil;
      }
  }
  </code></pre>
  
  <p>-</p>
  
  <pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  {
      if ([self shouldShowSectionHeader]) {
          return 20;
  
      } else {
          return 0;
      }
  }
  </code></pre>
  
  <p>It almost works. When I call <code>refreshSectionHeader</code>, the header appears correctly but no text is displayed (the label). As soon as I scroll the tableView, the text appears. Obviously, I want the text to appear right away. Any ideas how to solve this?</p>
  
  <p>Also, the header disappear correctly when <code>shouldShowSectionHeader</code> returns <code>NO</code>.</p>