iOS開源:ELWaterFallLayout-可定制瀑布流布局 UI 組件
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. To install
it, simply add the following line to your Podfile:
pod "ELWaterFallLayout"
Usage
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)
delegate protocol
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.
來自:https://github.com/NicolasKim/ELWaterFallLayout
本文由用戶 LinVera 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!