Latest 1.0.0
Homepage https://github.com/zhuyunfeng1224/XHWaterfallFlowLayout
License MIT
Platforms ios 8.0
Frameworks UIKit, Foundation
Authors

一个基于UICollectionViewFlowLayout的瀑布流布局 用于UICollectionView
经常做电商产品展示,需要用到瀑布流,这里整理下和大家分享~
image

使用方法

实现XHWaterfallFlowLayoutDelegate代理,并实现其中方法

- (CGFloat)getHeightExceptImageAtIndex:(NSIndexPath *)indexPath;
这个方法是返回除图片以外的高度

- (CGFloat)getImageRatioOfWidthAndHeight:(NSIndexPath *)indexPath;
这个方法返回图片宽高比例0-1

使用XHWaterfallFlowLayout同UICollectionViewFlowLayout

_flowLayout = [[XHWaterfallFlowLayout alloc] init];
    _flowLayout.columnCount = 2;    // 显示列数
    _flowLayout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
    _flowLayout.minimumInteritemSpacing = 10;
    _flowLayout.minimumLineSpacing = 10;
    _flowLayout.sDelegate = self;

导入

手工导入

下载或clone到本地,导入XHWaterfallFlowLayout.h和XHWaterfallFlowLayout.m文件即可
内含demo

cocoapods导入

pod 'XHWaterfallFlowLayout', '~> 1.0.0'

License

MIT license.

Latest podspec

{
    "name": "XHWaterfallFlowLayout",
    "version": "1.0.0",
    "summary": "u7011u5e03u6d41 Objective-C",
    "description": "TODO: u4e00u4e2au7011u5e03u6d41u5e03u5c40uff0cu53efu7528u4e8eu7535u5546u4ea7u54c1u7684u9648u5217.",
    "homepage": "https://github.com/zhuyunfeng1224/XHWaterfallFlowLayout",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "echo": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zhuyunfeng1224/XHWaterfallFlowLayout.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "XHWaterfallFlowLayout/Classes/**/*",
    "frameworks": [
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This