Skip to content
Dynamic waterfall flowlayout
Branch: master
Clone or download
NicolasKim Merge pull request #2 from ChaosTong/patch-1
fix crash when data array count down
Latest commit 7a54f3f Sep 13, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ELWaterFallLayout Update ELWaterFlowLayout.swift Aug 19, 2017
Example add vertical and horizontal scroll direction Feb 27, 2017
.gitignore Initial commit Feb 20, 2017
.swift-version first commit Feb 20, 2017
.travis.yml Initial commit Feb 20, 2017
ELWaterFallLayout.podspec add vertical and horizontal scroll direction Feb 27, 2017
LICENSE Initial commit Feb 20, 2017
README.md Update README.md Feb 27, 2017
_Pods.xcodeproj Initial commit Feb 20, 2017
screenshot.gif add screenshot Feb 20, 2017
screenshot.mov

README.md

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

jinqiucheng1006@live.cn

License

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

You can’t perform that action at this time.