Git Product home page Git Product logo

yhwaterlayoutforswift's Introduction

YHWaterLayOutForSwift

瀑布流的实现

效果图

效果图如图所示:

使用方法

该框架 只需要直接拖拽 YHWaterLayOut.swift文件 到需要的工程中, 挂上代理、实现代理方法即可。

  • 初始化
let  layout = YHWaterLayOut()//初始化布局

       layout.delegate = self;//设置代理

  self.collectionView.collectionViewLayout = layout//赋值布局
  • 代理方法
    /**
      * waterLayout:布局对象
      * width  计算出来的cell宽度
      * indexPath cell所在行
      * return  由cell宽度以及原图的尺寸计算出来的等比例高度
      */
     func  WaterLayOut(_waterLayout: YHWaterLayOut, cellForWidth width: CGFloat, heightForRowAtIndexPath indexPath:IndexPath) -> CGFloat
    
     /**
      * waterLayout:布局对象
      * return 使用者设置的列数
      */
     @objc optional func  waterLayOutForCellCloumnNum(_waterLayout : YHWaterLayOut)->NSInteger
    
     /**
      * waterLayout:布局对象
      * return 使用者设置的列数
      */
     @objc optional func  waterLayOutForCellCloumnMargin(_waterLayout : YHWaterLayOut)->CGFloat
    
     /**
      * waterLayout:布局对象
      * return 使用者设置的行间距
      */
     @objc optional func  waterLayOutForCellRowMargin(_waterLayout : YHWaterLayOut)->CGFloat
    
     /**
      * waterLayout:布局对象
      * return 使用者设置的四周边距
      */
     @objc optional func  waterLayOutForCellInSets(_waterLayout : YHWaterLayOut)->UIEdgeInsets
    

yhwaterlayoutforswift's People

Contributors

yuhao-ios avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.