title: How to resize an UIImageView (swift)
body: <p>I'm a beginner with swift and I can't get the resize of a UIImageView working.</p>
  
  <p>Here is my current layout :</p>
  
  <p><img src="https://i.stack.imgur.com/TI1Ba.png" alt="Current layout"></p>
  
  <p>What I want is to resize the images to occupy half the screen's width (2 images per row).</p>
  
  <p>Here is my storyboard : </p>
  
  <p><img src="https://i.stack.imgur.com/Se3hW.png" alt="storyboard"></p>
  
  <p>Here is the function drawing the collection view inside my controller :</p>
  
  <pre><code>func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) -&gt; UICollectionViewCell! {
          var cell : MenuInspirationCellView = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as MenuInspirationCellView
  
          cell.imageView.layer.borderWidth = 2
          cell.imageView.layer.borderColor = UIColor.yellowColor().CGColor
  
          //This is my first approach trying to modify the frame :
          cell.imageView.frame = CGRectMake(0,0, self.view.bounds.width / 2,v120)
          var cellImage : UIImage = UIImage(data: NSData(contentsOfURL: NSURL(string:              images[indexPath.row]))) 
          cell.imageView.image = cellImage;
  
          //This is my second approach (based on http://www.snip2code.com/Snippet/89236/Resize-Image-in-iOS-Swift) :
  
  
          // to resize an image to dimension 52x52
          //var newSize:CGSize = CGSize(width: 52,height: 52)
          //let rect = CGRectMake(0,0, newSize.width, newSize.height)
          //UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0)
          // image is a variable of type UIImage
          //cellImage.drawInRect(rect)
          //let newImage = UIGraphicsGetImageFromCurrentImageContext()
          //UIGraphicsEndImageContext()
          // resized image is stored in constant newImage
          //cell.imageView.image = newImage;
  
  
          //This is my thrid approach (based on https://gist.github.com/hcatlin/180e81cd961573e3c54d, of course i added his functions but I don't show them here for the sake of readability) :
           //cell.imageView.image = self.RBSquareImageTo(cellImage, size: CGSize(width: 80, height: 80))
  
          return cell
      }
  </code></pre>
  
  <p>Any leads to sort this out ?</p>