Code Monkey home page Code Monkey logo

systickheaderwaterfall's Introduction

SYStickHeaderWaterFall 中文介绍

License MIT  [CocoaPods](http://cocoapods.org/?q= SYStickHeaderWaterFall)  [CocoaPods](http://cocoapods.org/?q= SYStickHeaderWaterFall)  Support 

More flexible support various types of waterfalls flow .(更加灵活支持各种类型的瀑布流结构。)

image

以后封装任务: 1.装饰视图的增加。 2.暂时没想好,看官老爷可以给个idea。

安装

CocoaPods

  1. 将 cocoapods 更新至最新版本.
  2. 在 Podfile 中添加 pod "SYStickHeaderWaterFall"
  3. 执行 pod installpod update

(usage) 用法

(init and set delegate) 初始化并设置delegate:

SYStickHeaderWaterFallLayout *cvLayout = [[SYStickHeaderWaterFallLayout alloc] init];

cvLayout.delegate = self;

(set property) 设置属性:

//是否设置sectionHeader停留,默认YES

cvLayout.isStickyHeader = YES;

//section停留的位置是否包括原来设置的top,默认NO

cvLayout.isTopForHeader = YES;

//当你用UINavigationController和UITabbarViewController并设置一些属性时,collectionview的展示视图的坐标y会变得很奇怪,那就在此修正,默认64

cvLayout.fixTop = 64.0f;

(implement delegate method) 实现代理方法:

// 返回所在section的每个item的width(一个section只有一个width)

- (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
               layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
widthForItemInSection:( NSInteger )section;

// 返回所在indexPath的每个item的height(每个item有一个height,要不然怎么是瀑布流😄)

- (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
               layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
heightForItemAtIndexPath:(nonnull NSIndexPath *)indexPath;

@optional

// 返回所在indexPath的header的height

- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
                layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
heightForHeaderAtIndexPath:(nonnull NSIndexPath *)indexPath;

// 返回所在section与上一个section的间距(表达的可能不够准确,但是你们都懂的)

- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
                layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
topInSection:(NSInteger )section;

// 返回所在section与下一个section的间距(表达的可能不够准确,但是你们都懂的)

- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
                layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
        bottomInSection:( NSInteger)section;

// 返回所在section的header停留时与顶部的距离(如果设置isTopForHeader = yes ,则距离会叠加)

- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
                layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
       headerToTopInSection:( NSInteger)section;

有什么问题可以邮箱联系我,或者issue我。

systickheaderwaterfall's People

Contributors

zhangsuya avatar

Watchers

James Cloos avatar Yufeng.Meng 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.