title: Table View header get stuck when implementing pull to Refresh in Swift
body: <p>I have a table view inside a <code>UIViewController</code>. I have implemented a <code>UIRefreshControl</code> on the tableView. If I drag the table up while the refresh controller wheel is spinning the first header gets stuck in the middle of the table. I can't figure out what is wrong...</p>
  
  <p>Here is a screenshot of the problem:</p>
  
  <p><a href="https://i.stack.imgur.com/qYdrc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qYdrc.png" alt="enter image description here"></a></p>
  
  <p>Here is the code I used in <code>viewDidLoad</code>:</p>
  
  <pre><code>        refreshControl = UIRefreshControl()
          refreshControl.tintColor = UIColor.redColor()
          refreshControl.addTarget(self, action: "handleRefresh:", forControlEvents: UIControlEvents.ValueChanged)
          tableView.insertSubview(refreshControl, atIndex: 0)
          tableView.sendSubviewToBack(refreshControl)
  </code></pre>
  
  <p>And this is how I create the headers:</p>
  
  <pre><code>  func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
          let header: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView //recast view as a UITableViewHeaderFooterView
          header.contentView.backgroundColor = UIColor(red: 59/255, green: 134/255, blue: 134/255, alpha: 1.0) //make the background color light blue
          header.textLabel.textColor = UIColor.whiteColor() //make the text white
          header.alpha = 0.5 //make the header transparent
      }
  </code></pre>
  
  <p>Thanks a lot !</p>