https://github.com/nicolaskim/elwaterfalllayout
Dynamic waterfall flowlayout
https://github.com/nicolaskim/elwaterfalllayout
flowlayout ios swift3 waterfall
Last synced: 17 days ago
JSON representation
Dynamic waterfall flowlayout
- Host: GitHub
- URL: https://github.com/nicolaskim/elwaterfalllayout
- Owner: NicolasKim
- License: mit
- Created: 2017-02-20T06:24:27.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-13T01:49:57.000Z (over 7 years ago)
- Last Synced: 2025-04-07T14:01:54.405Z (20 days ago)
- Topics: flowlayout, ios, swift3, waterfall
- Language: Swift
- Homepage: http://dreamtracer.top
- Size: 2.53 MB
- Stars: 120
- Watchers: 3
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ELWaterFallLayout
[](https://travis-ci.org/[email protected]/ELWaterFallLayout)
[](http://cocoapods.org/pods/ELWaterFallLayout)
[](http://cocoapods.org/pods/ELWaterFallLayout)
[](http://cocoapods.org/pods/ELWaterFallLayout)## 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]([http://cocoapods.org](http://cocoapods.org)). To install
it, simply add the following line to your Podfile:
```ruby
pod "ELWaterFallLayout"
```## Usage
```
import ELWaterFallLayout
``````swift
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
```swift
func el_flowLayout(_ flowLayout: ELWaterFlowLayout, heightForRowAt index: Int) -> CGFloat {
//do something for the cell height
return height
}
```## Result
## Author
## License
ELWaterFallLayout is available under the MIT license. See the LICENSE file for more info.