To control the height of your UICollectionView cells and such, control drag the yellow cube ‘Flow layout’ from your storyboard into your implementation file.

Screen Shot 2017-01-13 at 6.59.10 AM.png

Screen Shot 2017-01-13 at 7.02.38 AM.png

Implement the UICollectionViewDelegateFlowLayout

Screen Shot 2017-01-13 at 7.01.19 AM.png

Assign your outlet to your collection view layout

Screen Shot 2017-01-13 at 7.06.29 AM.png

And then set your height as you see appropriate

Screen Shot 2017-01-13 at 7.10.03 AM.png

Code for copy paste

UICollectionViewDelegateFlowLayout

#pragma UICollectionViewDelegateFlowLayout

- (CGSize)collectionView:(UICollectionView *)collectionView
                  layout:(UICollectionViewLayout *)collectionViewLayout
  sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(collectionView.frame.size.width, self.collectionFlowLayout.itemSize.height);
}
Advertisements