KTCenterFlowLayout

Aligns collection view cells to the center of the screen.

Github星跟踪图

KTCenterFlowLayout

CocoaPods

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:

Horizontal Scrolling

This layout doesn't work with UICollectionViewScrollDirection.horizontal.

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!

主要指标

概览
名称与所有者keighl/KTCenterFlowLayout
主编程语言Objective-C
编程语言Objective-C (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2014-10-09 19:47:19
推送于2021-04-27 10:26:32
最后一次提交2016-12-21 09:30:32
发布数8
最新版本名称1.3 (发布于 )
第一版名称0.0.1 (发布于 )
用户参与
星数456
关注者数11
派生数58
提交数41
已启用问题?
问题数23
打开的问题数5
拉请求数7
打开的拉请求数3
关闭的拉请求数6
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?