Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 591 Bytes

README.md

File metadata and controls

16 lines (11 loc) · 591 Bytes

Sample of a Centered CollectionView Flow Layout

This is a sample of a Centered CollectionView Flow Layout, that is in detail explaing in my blog post here.

The result of the layout looks like:

CenteredCollectionViewFlowLayout

Usage

Just initialize the UICollectionViewCenterLayout object and set it as the collectionViewLayout of your UICollectionView:

let layout = UICollectionViewCenterLayout()
layout.estimatedItemSize = CGSize(width: 140, height: 40)
collectionView.collectionViewLayout = layout