title: How to center a cell with the content offset in a UICollectionView with scrollToItemAtIndexPath
body: <p>I am implementing a UICollectionView which shows only a single line of cells. It is like an image cover flow. This means I have subclassed UICollectionViewFlowLayout.  My implementation works fine when I use my finger for scrolling, meaning that the following delegate method is called and I center the cell;</p>
  
  <pre><code>-(CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
  </code></pre>
  
  <p>However when the view loads I want the view to automatically scroll to a cell.  For this automatic scroll I use the following;</p>
  
  <pre><code>[self.CollectionView scrollToItemAtIndexPath:_selectedIndexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];
  </code></pre>
  
  <p>The problem is that targetContentOffsetForProposedContentOffset is not called and thus when the automatic scroll is complete the cell is off the centre.</p>
  
  <p>So how can I programmatically scroll my collection view so that it will also centre on the cell being scrolled to?</p>