title: Create stretchy headers swift
body: <p>I have a <code>UICollectionView</code> with a <code>UIView</code> as a header.</p>
  
  <p>I want that when the user scrolls down the header will be stretched with a stretchy header effect.</p>
  
  <p>I've tried this code:</p>
  
  <pre><code>func scrollViewDidScroll(scrollView: UIScrollView) {
      if scrollView.contentOffset.y &lt; 0 {
          self.backgroundImageView?.frame.size.height += -scrollView.contentOffset.y
          self.backgroundImageView?.frame.size.width += -scrollView.contentOffset.y
      } 
  }
  </code></pre>
  
  <p>But it has 2 problems:</p>
  
  <ul>
  <li><p>When the scrolling starts, the image isn't in the centre anymore (it keeps the 0x 0y origin I guess)</p></li>
  <li><p>The image keep sizing even when the releases the touch (or when he scrolls up) and doesn't returns to its original size.</p></li>
  </ul>
  
  <p>Anyone can help me find a code that will work?</p>