title: Preserve Image Aspect Ratio in UICollectionViewCell
body: <p><strong>Problem:</strong> Reloaded cached UIImageView in a UICollectionViewCell (during scrolling <em>or</em> switching between UICollectionViewController) are not preserving the correct contentMode.</p>
  
  <p>I tried using .sizeToFit() on the UIImageView and resetting .contentMode = UIViewContentMode.ScaleAspectFit on every load, but that wasn't helping.</p>
  
  <pre><code>override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; MyCollectionViewCell {
  
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier("myCell", forIndexPath: indexPath) as! MyCollectionViewCell
  
      if ( indexPath.item &lt; self.the_array?.count ){
  
          if ( images_cache[self.the_array![indexPath.item].src!] != nil ){
              // calling this here doesn't work
              cell.myImage.contentMode = UIViewContentMode.ScaleAspectFit
              // calling this here doesn't work either
              cell.myImage.sizeToFit()
              cell.myImage.image = images_cache[self.the_array![indexPath.item].src!]! as UIImage
          }
          else{
              if let url  = NSURL(string: "https:" + (self.the_array![indexPath.item].src)!), data = NSData(contentsOfURL: url) {
                  let the_image = UIImage( data: data )
                  cell.myImage.image = the_image
                  images_cache[self.the_array![indexPath.item].src!] = the_image!
              }
          }
      }
      return cell
  }
  </code></pre>