KTCenterFlowLayout 1.3.1

KTCenterFlowLayout 1.3.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Oct 2016

Maintained by Kyle Truscott.


Downloads

Total901,172
Week9,389
Month36,841

Installs

Apps6,800
Apps WeekApps This Week 420
Pod Tries10
Test Targets1,908
Test WeekTests This week 60
Watch Apps3
powered by Segment

GitHub

Stars370
Watchers11
Forks51
Issues1
Contributors5
Pull Requests2

Code

Files2
LOCLines of Code 125


KTCenterFlowLayout is a subclass of UICollectionViewFlowLayout which Aligns cells to the center of a collection view. It effectively enforces the minimumInteritemSpacing.

Usage

# In your Podfile

pod 'KTCenterFlowLayout'

Objective-C:

KTCenterFlowLayout *layout = [KTCenterFlowLayout new];
layout.minimumInteritemSpacing = 10.f;
layout.minimumLineSpacing = 10.f;

[[UICollectionViewController alloc] initWithCollectionViewLayout:layout];

Swift:

let layout = KTCenterFlowLayout()
layout.minimumInteritemSpacing = 10.0
layout.minimumLineSpacing = 10.0

UICollectionViewController(collectionViewLayout: layout)

Example

See the layout in use in the ./Example app:

Self-sizing cells

This layout doesn't work with self-sizing collection view cells (estimatedItemSize). Of course, neither does the vanilla UICollectionViewFlowLayout. Pull requests appreciated from anybody interested in solving self-sizing layouts!