title: UICollectionView with FlowLayout not scrolling when setting section insets
body: <p>I am using a UICollectionView programmatically.</p>
  
  <p>I've set its frame as follows:</p>
  
  <pre><code>UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 3000) collectionViewLayout:flowLayout];
  </code></pre>
  
  <p>My <code>UICollectionViewFlowLayout</code> has a section inset set as:</p>
  
  <pre><code>flowLayout.sectionInset = UIEdgeInsetsMake(20.0, 20.0, 100.0, 20.0);
  </code></pre>
  
  <p>I also only have 1 section.</p>
  
  <p>I've set the height to be 3,000 to see if the collection view would scroll but it doesn't. I am setting it to that since the collection view doesn't seem to scroll up or down when I insert new items.</p>
  
  <p><code>UICollectionView</code> is subclassed from a <code>UIScrollView</code>, which means I can keep resetting the scroll view content size. Would this work properly?</p>
  
  <p>The only issue is that this would work if I know the sizes of all items including how many items are on each row.</p>
  
  <p>If each item had a different size, how would I find out the size of each row? I would need that to add all row sizes and increase the content size height of <code>self.collectionView</code>.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Even my suggestion above, resetting the content size, does not work properly! I tried the following when updating my collection view:</p>
  
  <pre><code> int numberOfRows = self.dataArray.count / 3;
  self.collectionView.contentSize = CGSizeMake(self.view.frame.size.width, (numberOfRows * 200) + 300);
  </code></pre>
  
  <p>This is very ugly though. This is because it assumes all my images are of size 200x200px, which fits 3 images per row (hence the division by 3). </p>
  
  <p>Furthermore, even with the +300 that I have, the last row I can only see about 3/4 of it and not all of it. I have to scroll more and I will be able to see it but it goes back up again to 3/4. Its kind of like the scroll to refresh, where the view only moves if you drag it and when you leave it bumps back to where it was. Why is this happening? Is it just that Apple designed <code>UICollectionView</code> so poorly? This is a little ridiculous... UITableViews adjust their scroll according to their content automatically.</p>