title: Change the background color of header in a UITableView
body: <p>I am trying to change the background color of the header in the UITableViewController, which actually has it's own *.h/m file.    I my .m file, I pasted the following code as suggested by several stackoverflow answers:</p>
  
  <pre><code>- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
  {
      UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)];
      if (section == 0)
          [headerView setBackgroundColor:[UIColor redColor]];
      else 
          [headerView setBackgroundColor:[UIColor clearColor]];
      return headerView;
  }
  </code></pre>
  
  <p>But the result is the following:</p>
  
  <p><img src="https://i.stack.imgur.com/vjIvD.png" alt="enter image description here"></p>
  
  <p>I want the blue header to be red.  I don't understand why there is a red bar between the header and the first cell.</p>
  
  <p><strong>Additional Details</strong>
  In case this comment is useful: I'm new to xcode 4.2. What I did was go to storyboard, drag a navigation controller, drag a table view. Go to left hand explorer bard and add a new file with name MyUITableViewController that extends UITableviewController. Pasted my function above into the MyUITabelViewController.m file. Then i implemented the heightforheaderinsection funciton to return a CGfloat value (and all that did afterwards was increase the space between the blue header and the first cell).  Go back to storyboard, left click my tableviewcontroller and make sure it points to my MyUITableViewController class. What steps am I missing?</p>