title: UICollectionViewCell's subview absolute frame
body: <p>Have been having this issue that I considered to be an easy solve, but spent a lot of time cracking it with no result.</p>
  
  <p>So, I have a <strong>UIViewController</strong> with <strong>UICollectionView</strong> in it. This collection is padded 75 px from the top and has cells with pretty simple setup - just 1 <strong>UIImageView</strong> set to fit the size of the container. Everything is made with <strong>AutoLayout</strong>. </p>
  
  <p>My task is to make <strong>UIImageView</strong> go full screen on tap. What I am doing is making a temporary <strong>UIImageView</strong> and add to the hierarchy of <strong>UIViewController</strong> view. </p>
  
  <p>The problem I am facing is I can't get the absolute frame of <strong>UIImageView</strong> in the cell I tap. </p>
  
  <p>I tried various ways to calculate the frame, my most recent try is </p>
  
  <pre><code>var rect = cell.imageView.superview!.convertRect(cell.imageView.frame, toView: self.view)
  </code></pre>
  
  <p>However, it returns result that seems to be ignoring the collection view top constraint.</p>
  
  <p><strong>Update</strong>:</p>
  
  <p>It turns out my problem was in the wrong way I was acquiring the cell from collection view. Instead of:</p>
  
  <pre><code>let cell = collectionView.cellForItemAtIndexPath(indexPath) as! UIImageCollectionViewCell
  </code></pre>
  
  <p>I was getting cell with </p>
  
  <pre><code>let cell = self.collectionView(collectionView, cellForItemAtIndexPath: indexPath) as! UIImageCollectionViewCell
  </code></pre>
  
  <p>Which obviously resulted in creating a new cell with the wrong frame. My bad, late night coding is not the best thing sometimes. Thanks to <a href="https://stackoverflow.com/users/5746309/arun-ammannaya">Arun Ammannaya</a> for the quick example</p>