title: CALayer not resizing with Autolayout
body: <p>I have created a progress bar to be used in a tableView by creating a gradient layer. It works perfectly. </p>
  
  <p><strong>iPhone5:</strong>
  <img src="https://i.stack.imgur.com/J2Cuz.png" alt="enter image description here"></p>
  
  <p>In order to use the app on multiple devices, I have created the UIView in Storyboard, tagged it and added constraints. 
  However, when I use the app on an iPhone 6 the CALayer don't resize. </p>
  
  <p><strong>iPhone6:</strong>
  <img src="https://i.stack.imgur.com/Qj0d3.png" alt="enter image description here"></p>
  
  <p>I find this extremely stupid, but never mind.  I have looked around and tried to understand how to solve this for months, but I have come up short.  Does <strong>ANYONE</strong> know how to make CALayers resize with the UIView?  Any help would be very much appreciated ! Thank you.</p>
  
  <pre><code>        progressBar =  cell.contentView.viewWithTag(3) as UIView!
          progressBar.layer.cornerRadius = 4
          progressBar.layer.masksToBounds = true
  
  
          // create gradient layer
          let gradient : CAGradientLayer = CAGradientLayer()
  
          // create color array
          let arrayColors: [AnyObject] = [
              UIColor (red: 255/255, green: 138/255, blue: 1/255, alpha: 1).CGColor,
              UIColor (red: 110/255, green: 110/255, blue: 118/255, alpha: 1).CGColor]
  
          // set gradient frame bounds to match progressBar bounds
          gradient.frame = progressBar.bounds
  
          // set gradient's color array
          gradient.colors = arrayColors
  
          //Set progress(progressBar)
          var percentageCompleted = 0.6
  
          gradient.startPoint = CGPoint(x: 0.0, y: 0.5)
          gradient.locations = [percentageCompleted, percentageCompleted]
          gradient.endPoint = CGPoint(x: 1, y: 0.5)
  
          // replace base layer with gradient layer
          progressBar.layer.insertSublayer(gradient, atIndex: 0)
  </code></pre>