Skip to content

Aligns collection view cells to the center of the screen.

License

Notifications You must be signed in to change notification settings

observadorpt/KTCenterFlowLayout

 
 

Repository files navigation

KTCenterFlowLayout

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:

About

Aligns collection view cells to the center of the screen.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 93.7%
  • Ruby 6.3%