title: UICollectionView cell size in AutoLayout
body: <p>So I'm using <code>UICollectionView</code> under <code>AutoLayout</code>-enabled storyboard.
  I'm trying to set cell size based on <code>collectionView</code> itself and it's based on <code>[collectionView: layout: sizeForItemAtIndexPath:]</code> method.
  <code>collectionView</code> also depends on auto layout and it gives wrong size at first time (I assume this is before view is layouted).
  I know they will have correct size after <code>viewDidLayoutSubviews</code> method is called but it causes double reloading of the <code>collectionView</code> items which makes UI glitches at run time.</p>
  
  <p>Here is <code>[collectionView: layout: sizeForItemAtIndexPath:]</code> method of my implementation.</p>
  
  <pre><code>- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  {
      CGSize innerSize = CGSizeMake(galleryView.frame.size.width - 80, galleryView.frame.size.height - 40);
      GLPhotoAsset *photo = [(PCOpticsPhotoPoint *)_cluster.points[indexPath.row] photo];
      CGFloat ratio = MIN(innerSize.width / photo.size.width, innerSize.height / photo.size.height);
  
      return CGSizeMake(photo.size.width * ratio, photo.size.height * ratio);
  }
  </code></pre>