title: UICollectionViewCell content wrong size on first load
body: <p>I have a added a <code>UICollectionView</code> to my <code>UIViewController</code> and have made a custom cell for it.</p>
  
  <p>I set the size of the cell using the <code>sizeForItemAtIndexPath</code> method and set each cell to be <code>UIScreen.mainScreen().bounds.width/2</code> in both height and width. So essentially, each cell is half the screen wide and this same length in height.</p>
  
  <p>I then have an <code>UIImageView</code> inside the cell with each edge pinned to its relative edge of the cell so that the image view fills the cell. I also have a <code>UILabel</code> that is centred both vertically and horizontally in the cell.</p>
  
  <p>However on first load, the cell is the correct size but the content is much smaller in a tiny square in the top left. (Seen in the image below, I have set the cell's contentView background color to green and the imageView background color to red).</p>
  
  <p><a href="https://i.stack.imgur.com/Bs7wc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Bs7wc.png" alt="enter image description here"></a></p>
  
  <p>Then after scrolling down a little bit (and I assume a reusable cell being dequeued) all of the cells are fine (and remain fine after scrolling back up).</p>
  
  <p><a href="https://i.stack.imgur.com/oqp1N.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oqp1N.png" alt="enter image description here"></a></p>
  
  <p>What is causing the content to not be constrained properly on first load?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Some of the code from my <code>UIViewController</code>:</p>
  
  <pre><code>func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
          var cell = collectionView.dequeueReusableCellWithReuseIdentifier("PrevDrawCell", forIndexPath: indexPath) as? PrevDrawCell
  
          if cell == nil {
              cell = PrevDrawCell()
          }
  
          cell!.drawVC = self
          cell!.imageShortCode = self.tempImageURLs[indexPath.row]
  
          // Pull image (async) and set after download
          cell!.setupImage()
  
          cell!.contentView.backgroundColor = UIColor.greenColor()
          cell!.coverView.backgroundColor = UIColor.redColor()
  
          cell!.dateLabel.font = UIFont(name: "HelveticaNeue-Light", size: 26)
          cell!.dateLabel.text = "\(self.tempImageURLs.count-indexPath.row)/9"
  
          return cell!
  }
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -&gt; CGSize {
      let size = UIScreen.mainScreen().bounds.width/2
          return CGSize(width: size, height: size)
  }
  
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -&gt; UIEdgeInsets {
          return UIEdgeInsetsZero
  }
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAtIndex section: Int) -&gt; CGFloat {
      return 0
  }
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -&gt; CGFloat {
      return 0
  }
  </code></pre>