ETCollectionViewWaterFallLayout: Swift 版本一种小巧的瀑布流布局翻译 / 编辑

最近提交:8月前
创建时间:2017.04.22

语言构成

Swift97.6%
Ruby2.4%

README

ETCollectionViewWaterFallLayout

CocoaPods CocoaPods CocoaPods

ETCollectionViewWaterFallLayout is the swift version of CHTCollectionViewWaterfallLayout!

Screen Shots

demo

Installation

The preferred way of installation is via CocoaPods. Just add

pod 'ETCollectionViewWaterFallLayout'

and run pod install. It will install the most recent version of ETCollectionViewWaterFallLayout.

Usage

Below are the public properties and their default values that you can change to customize the layout

let layout = ETCollectionViewWaterfallLayout()
layout.minimumColumnSpacing = 10.0
layout.minimumInteritemSpacing = 10.0
layout.columnCount = 2
layout.headerHeight = 0.0
layout.footerHeight = 0.0
layout.headerInset = .zero
layout.footerInset = .zero
layout.sectionInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
collectionView.collectionViewLayout = layout

Required Protocol

Your collection view's delegate must conforms to ETCollectionViewDelegateWaterfallLayout protocol and implement the required method, all you need to do is return the original size of the item:

func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0+

Objective-C Version


LICENSE

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

讨论区

说说你的看法