All Projects → NicolasKim → Elwaterfalllayout

NicolasKim / Elwaterfalllayout

Licence: mit
Dynamic waterfall flowlayout

Programming Languages

swift
15916 projects
swift3
66 projects

Labels

ELWaterFallLayout

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ELWaterFallLayout is available through CocoaPods. To install

it, simply add the following line to your Podfile:

pod "ELWaterFallLayout"

Usage

import ELWaterFallLayout
lazy var flowLayout : ELWaterFlowLayout = ELWaterFlowLayout()
flowLayout.scrollDirection = .horizontal //.vertical
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.edge = UIEdgeInsets.zero
collectionView.register(TestCollectionViewCell.self, forCellWithReuseIdentifier: "cell")
self.view.addSubview(collectionView)

delegate protocol

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

Result

image

Author

[email protected]

License

ELWaterFallLayout is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].