欢迎光临
我们一直在努力

CHTCollectionViewWaterfallLayout

建站超值云服务器,限时71元/月

CHTCollectionViewWaterfallLayout

项目介绍:

CHTCollectionViewWaterfallLayout是UICollectionViewLayout的子类,试图将UICollectionViewFlowLayout所有使用方法模拟了出来。

Features 功能

  • 使用简单,完全模拟UICollectionViewFlowLayout‘s的使用方法。
  • 拥有高度自定义功能。
  • 性能出众,10000+的items对他来说都毫无压力
  • 支持header and footer views.
  • 不同的列可以用不同的sections

Prerequisite 环境需求

  • ARC
  • Xcode 4.4+, which supports literals syntax.
  • iOS 6+, or
  • iOS 4.x/5.x, with PSTCollectionView.

使用方法如下
Step 1

Below lists the properties for you to customize the layout. Although they have default values, I strongly recommend you to set up at least the columnCount property to suit your needs. The itemRenderDirection property is an enum which decides the order in which your items will be rendered in subsequent rows. For eg. Left-Right | Right-Left | Shortest column filling up first.

[Objective-C] 查看源文件 复制代码

@property (nonatomic, assign) NSInteger columnCount;
@property (nonatomic, assign) CGFloat minimumColumnSpacing;
@property (nonatomic, assign) CGFloat minimumInteritemSpacing;
@property (nonatomic, assign) CGFloat headerHeight;
@property (nonatomic, assign) CGFloat footerHeight;
@property (nonatomic, assign) UIEdgeInsets sectionInset;
@property (nonatomic, assign) ItemRenderDirection itemRenderDirection;

Step 2

Your collection view’s delegate (which often is your view controller) must conforms toCHTCollectionViewDelegateWaterfallLayout protocol and implements the required method, all you need to do is return the original size of the item:

[Objective-C] 查看源文件 复制代码

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;

DEMO 直接下载 (OC 和 Swift):

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » CHTCollectionViewWaterfallLayout
分享到: 更多 (0)