ELWaterFallLayout 0.1.2

ELWaterFallLayout 0.1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2017年2月
SwiftSwift 版本3.0.2
SPM支持 SPM

Nicolas Kim 维护。



示例

要运行示例项目,首先克隆仓库,然后从示例目录运行 pod install

要求

安装

ELWaterFallLayout 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "ELWaterFallLayout"

用法

import ELWaterFallLayout
lazy var flowLayout : ELWaterFlowLayout = ELWaterFlowLayout()
collectionView = UICollectionView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: self.view.frame.size.width, height: self.view.frame.size.height - 200)) , collectionViewLayout:flowLayout)
collectionView.backgroundColor = UIColor.white
collectionView.delegate = self
collectionView.dataSource = self
self.flowLayout.delegate = self
flowLayout.lineCount = 10//十列
flowLayout.vItemSpace = 10//水平间距10
flowLayout.hItemSpace = 10//水平间距10
flowLayout.hItemSpace = 10//水平间距10
flowLayout.edge = UIEdgeInsets.zero
collectionView.register(TestCollectionViewCell.self, forCellWithReuseIdentifier: "cell")
self.view.addSubview(collectionView)

委托协议

func el_flowLayout(_ flowLayout: ELWaterFlowLayout, heightForRowAt index: Int) -> CGFloat {
//do something for the cell height
return height
}

结果

image

作者

[email protected]

许可证

ELWaterFallLayout 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。