Latest 0.0.2
Homepage https://github.com/EasySnail/EWaterFallView
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, Foundation
Authors

EWaterFallView 瀑布流

image

pods引用

pod 'EWaterFallView', '~> 0.0.2'

使用

- (EWaterFallView *)fview{
    if (_fview == nil) {
        __weak TestVC *weakSelf = self;
        _fview = [[EWaterFallView alloc] init];
        //注册cell,默认 UICollectionViewCell
        _fview.registerClassCell = @"TestCell";
        //设置参数
        _fview.setParamBlock = ^(EWaterFallLayout *layout) {
            //设置三列
            layout.columnCount = 3;
            //设置间距
            layout.rowSpacing = 5;
            layout.columnSpacing = 5;
            //设置偏移
            layout.sectionInset = UIEdgeInsetsZero;
        };
        //返回每个item的高度
        _fview.itemHeightBlock = ^CGFloat(CGFloat itemWidth, NSIndexPath *indexPath) {
            return [weakSelf.dataArray[indexPath.row][@"ratio"] floatValue] *itemWidth + 20;
        };
        //返回总个数
        _fview.numberOfRowsBlock = ^NSInteger{
            return weakSelf.dataArray.count;
        };
        //返回设置cell
        _fview.cellDataBlock = ^id(UICollectionViewCell *cell, NSIndexPath *indexPath) {
            /*
                1.直接设置cell
             或者
                2.也可以在cell遵循协议执行方法:
                - (void)updateData:(id)data indexPath:(NSIndexPath *)indexPath;
             */
            return weakSelf.dataArray[indexPath.row];
        };
        //点击cell
        _fview.didSelectAtIndexPathBlock = ^(NSIndexPath *indexPath) {
            NSLog(@"%ld",indexPath.row);
        };

        [self.view addSubview:_fview];

        //获取数据后刷新
        [_fview reloadData];
    }
    return _fview;
}

Latest podspec

{
    "name": "EWaterFallView",
    "version": "0.0.2",
    "platforms": {
        "ios": "8.0"
    },
    "summary": "waterfall u7011u5e03u6d41",
    "homepage": "https://github.com/EasySnail/EWaterFallView",
    "license": "MIT",
    "authors": {
        "EasySnail": "[email protected]"
    },
    "source": {
        "git": "https://github.com/EasySnail/EWaterFallView.git",
        "tag": "0.0.2"
    },
    "source_files": "EWaterFallView/EWaterFall",
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This