iOS开源:ELWaterFallLayout-可定制瀑布流布局 UI 组件
<h2>ELWaterFallLayout</h2> <h2>Example</h2> <p>To run the example project, clone the repo, and run pod install from the Example directory first.</p> <h2>Requirements</h2> <h2>Installation</h2> <p>ELWaterFallLayout is available through CocoaPods. To install</p> <p>it, simply add the following line to your Podfile:</p> <pre> pod "ELWaterFallLayout"</pre> <h2>Usage</h2> <pre> import ELWaterFallLayout</pre> <pre> 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)</pre> <h3>delegate protocol</h3> <pre> func el_flowLayout(_ flowLayout: ELWaterFlowLayout, heightForRowAt index: Int) -> CGFloat { //do something for the cell height return height }</pre> <h2>Result</h2> <p style="text-align: center;"><img src="https://simg.open-open.com/show/840b1b4467a5a5fb672cddccaacc8bf9.gif"></p> <h2>Author</h2> <p><a href="/misc/goto?guid=4959738876500926655" rel="nofollow,noindex">jinqiucheng1006@live.cn</a></p> <h2>License</h2> <p>ELWaterFallLayout is available under the MIT license. See the LICENSE file for more info.</p> <p> </p> <p>来自:https://github.com/NicolasKim/ELWaterFallLayout</p> <p> </p>
本文由用户 LinVera 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!