Skip to content

dejanskledar/centered-collectionview-layout

Repository files navigation

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

About

This is a sample of a Centered CollectionView Flow Layout

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages