Use the UICollectionViewDelegateFlowLayout methods to adjust the size of your cell
for example, if you want 3 cells in the width of the view
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { let width = CGRectGetWidth(collectionView.bounds) let hcount = 3 let gapcount = CGFloat(hcount) + 1
You can adjust the distance between cells with
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -> CGFloat
and edge inserts with
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets
Warren burton
source share