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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?