So, what did work?

1) Subclass UICollectionViewFlowLayout.

2) Set the flowLayout of my UICollectionView to my new subclass.

3) On the init method of the UICollectionViewFlowLayout subclass, set the orientation you want:

self.scrollDirection = UICollectionViewScrollDirectionHorizontal;

In my case it is Horizontal.

4) The important part:

-(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
   return YES;
}

At this moment, I should theorise a bit, but honestly I don't have a clue.


The above answers didn't work for me, but after downloading the images, I replaced the code [self.myCollectionView reloadData] with [self.myCollectionView reloadSections:[NSIndexSet indexSetWithIndex:0]]; to refresh the collectionview and it shows all cells, you can try it.