title: Get the Center Point of a Cell Embedded in Scroll View
body: <p>I have a UICollectionView embedded in a scroll view: <img src="https://i.stack.imgur.com/AnODa.png" alt="see picture"></p>
  
  <p>Each white square is a collection view cell.  The user can scroll horizontally to reveal additional cells. </p>
  
  <p>When the user clicks on a cell, I have created an animation which causes that cell to expand from its own center outward as a transition is made to a new view controller.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>//cell is selected:
  
  //grab snapshot of cell
  UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
  UIImage *cellImage = [self imageOfCollectionCell:cell]; 
  
  //hold the snapshot in this dict    
  NSMutableDictionary *cellImageDict = [[NSMutableDictionary alloc]init];
  [cellImageDict setObject:cellImage forKey:SELECTED_INBOX_EMAIL_IMAGE];
  [ViewControllerSnapShotDictionary sharedInstance].vcdict = nil;
  [ViewControllerSnapShotDictionary sharedInstance].vcdict = cellImageDict; 
  
  //get the center of the cell (HERE IS WHERE THE PROBLEM IS)
  CGPoint cellCenter = CGPointMake(cell.center.x, cell.center.y);
  
  //do the animation using the snapshot and cell center
  [self startPinchingOutCellFromCenterPoint:cellCenter forTransitionTo:emailController withSnapShotImage:SELECTED_INBOX_EMAIL_IMAGE]; 
  </code></pre>
  
  <p>The code works fine, EXCEPT if the collection view has been scrolled. The animation requires that I know where the center of the cell is at the moment it is on screen, being touched and relative to the coordinates of the view I am looking at. </p>
  
  <p><strong>For example</strong>, if the collection view has not been scrolled, and I select the center cell of the above image, the center might return as: </p>
  
  <pre><code>cell.center.x = 490
  cell.center.y = 374
  </code></pre>
  
  <p>However, if I do a scroll to the right, and then select the new center cell, I might get something like:</p>
  
  <pre><code>cell.center.x = 1770
  cell.center.y = 374
  </code></pre>
  
  <p>My question is, is there either a better way to accomplish what I am trying to do, OR is there a way to get a handle on the center of the cell as it lies in its current position in self.view?</p>