Latest 0.0.2
Homepage https://github.com/Zyj163/YJWaterFlowLayout
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.
image

Requirements

Installation

YJWaterFlowLayout is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "YJWaterFlowLayout", :git => 'https://github.com/Zyj163/YJWaterFlowLayout.git'

Use

属性:

waterCount

瀑布流的条数,默认为2

minimumWaterSpacing

流间距,默认是10(优先级低于代理方法中的设置)

minimumItemSpacing

同一流中item间距,默认是10(优先级低于代理方法中的设置)

headerSize

section头视图大小,默认没有(优先级低于代理方法中的设置,并且如果是纵向布局,宽度固定为collectionView宽度,横向亦然)

footerSize

section脚视图大小,默认没有(优先级低于代理方法中的设置,并且如果是纵向布局,宽度固定为collectionView宽度,横向亦然)

sectionInset

section内边距,默认没有(优先级低于代理方法中的设置)

layoutDirection

流动方向,默认纵向

unionSize

批量布局个数,可以根据一屏最多可以显示多少个item来设置,默认20

delegate 代理
moveAction 拖拽代理

返回indexPath对应item的size,必须实现

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

返回section对应header的size,可选实现,如果没有实现,使用属性headerSize

func collectionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
sizeForHeaderInSection section: NSInteger) -> CGSize

返回section对应footer的size,可选实现,如果没有实现,使用属性footerSize

func collectionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
sizeForFooterInSection section: NSInteger) -> CGSize

返回section中内边距,可选实现,如果没有实现,使用属性sectionInset

func collectionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
insetForSectionAtIndex section: NSInteger) -> UIEdgeInsets

返回section中同一流中item的间距,可选实现,如果没有实现,使用属性minimumItemSpacing

func collectionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
minimumItemSpacingForSection section: NSInteger) -> CGFloat

返回section中流间距,可选实现,如果没有实现,使用属性minimumWaterSpacing

func collectionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
minimumWaterSpacingForSection section: NSInteger) -> CGFloat

拖拽需要实现的方法
extension ViewController: YJWaterLayoutMovable {
func enableMoveItem( layout: YJWaterFlowLayout) -> Bool {
return true
}
}
func collectionView(
collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
(collectionView.collectionViewLayout as! YJWaterFlowLayout).moveItem(&datas, moveItemAt: sourceIndexPath, to: destinationIndexPath)
}

YJCollectionSectionHeader header的类型string
YJCollectionSectionFooter footer的类型string

注意:
每个属性的重新设置都会更新布局

Author

Zyj163, [email protected]

License

YJWaterFlowLayout is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "YJWaterFlowLayout",
    "version": "0.0.2",
    "summary": "YJWaterFlowLayout",
    "description": "YJWaterFlowLayout  u6a2au5411u7eb5u5411u7011u5e03u6d41u5e03u5c40uff0cu53efu62d6u62fditemuff0cu53efu6dfbu52a0u5934u89c6u56feu548cu811au89c6u56fe",
    "homepage": "https://github.com/Zyj163/YJWaterFlowLayout",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Zyj163": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Zyj163/YJWaterFlowLayout.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "YJWaterFlowLayout/Classes/**/*",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This