• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

UICollectionView WaterFlowLayout. 瀑布流.

UICollectionViewLayout各种布局

三种有趣的布局, 线性布局, 圆形布局, 格子布局

App首页布局

@class LMJElementsFlowLayout;


@protocol LMJElementsFlowLayoutDelegate <NSObject>

@required
/**
 *  要求实现
 *
 *  @param waterflowLayout 哪个布局需要代理返回大小
 *  @param  indexPath          对应的cell, 的indexPath, 但是indexPath.section == 0
 *
 *  @return 需要代理高度对应的cell的尺寸
 */
- (CGSize)waterflowLayout:(LMJElementsFlowLayout *)waterflowLayout collectionView:(UICollectionView *)collectionView sizeForItemAtIndexPath:(NSIndexPath *)indexPath;



@optional

/**
 *  列间距, 默认10
 */
- (CGFloat)waterflowLayout:(LMJElementsFlowLayout *)waterflowLayout collectionView:(UICollectionView *)collectionView columnsMarginForItemAtIndexPath:(NSIndexPath *)indexPath;

/**
 *  行间距, 默认10
 */
- (CGFloat)waterflowLayout:(LMJElementsFlowLayout *)waterflowLayout collectionView:(UICollectionView *)collectionView linesMarginForItemAtIndexPath:(NSIndexPath *)indexPath;

/**
 *  距离collectionView四周的间距, 默认{20, 10, 10, 10}
 */
- (UIEdgeInsets)waterflowLayout:(LMJElementsFlowLayout *)waterflowLayout edgeInsetsInCollectionView:(UICollectionView *)collectionView;


@end


@interface LMJElementsFlowLayout : UICollectionViewLayout

/** layout的代理 */
- (instancetype)initWithDelegate:(id<LMJElementsFlowLayoutDelegate>)delegate;

+ (instancetype)flowLayoutWithDelegate:(id<LMJElementsFlowLayoutDelegate>)delegate;


@end

水平流水布局

@class LMJHorizontalFlowLayout;


@protocol LMJHorizontalFlowLayoutDelegate <NSObject>

@required
/**
 *  要求实现
 *
 *  @param waterflowLayout 哪个布局需要代理返回高度
 *  @param  indexPath          对应的cell, 的indexPath, 但是indexPath.section == 0
 *  @param itemHeight           layout内部计算的高度
 *
 *  @return 需要代理高度对应的cell的宽度
 */
- (CGFloat)waterflowLayout:(LMJHorizontalFlowLayout *)waterflowLayout collectionView:(UICollectionView *)collectionView widthForItemAtIndexPath:(NSIndexPath *)indexPath itemHeight:(CGFloat)itemHeight;
@optional

/**
 *  需要显示的行数, 默认3
 */
- (NSInteger)waterflowLayout:(LMJHorizontalFlowLayout *)waterflowLayout linesInCollectionView:(UICollectionView *)collectionView;
/**
 *  列间距, 默认10
 */
- (CGFloat)waterflowLayout:(LMJHorizontalFlowLayout *)waterflowLayout collectionView:(UICollectionView *)collectionView columnsMarginForItemAtIndexPath:(NSIndexPath *)indexPath;
/**
 *  行间距, 默认10
 */
- (CGFloat)waterflowLayout:(LMJHorizontalFlowLayout *)waterflowLayout linesMarginInCollectionView:(UICollectionView *)collectionView;

/**
 *  距离collectionView四周的间距, 默认{10, 10, 10, 10}
 */
- (UIEdgeInsets)waterflowLayout:(LMJHorizontalFlowLayout *)waterflowLayout edgeInsetsInCollectionView:(UICollectionView *)collectionView;


@end



@interface LMJHorizontalFlowLayout : UICollectionViewLayout

/** layout的代理 */
- (instancetype)initWithDelegate:(id<LMJHorizontalFlowLayoutDelegate>)delegate;

+ (instancetype)flowLayoutWithDelegate:(id<LMJHorizontalFlowLayoutDelegate>)delegate;
@end

垂直流水布局

@class LMJVerticalFlowLayout;


@protocol LMJVerticalFlowLayoutDelegate <NSObject>

@required
/**
 *  要求实现
 *
 *  @param waterflowLayout 哪个布局需要代理返回高度
 *  @param  indexPath          对应的cell, 的indexPath, 但是indexPath.section == 0
 *  @param width           layout内部计算的宽度
 *
 *  @return 需要代理高度对应的cell的高度
 */
- (CGFloat)waterflowLayout:(LMJVerticalFlowLayout *)waterflowLayout collectionView:(UICollectionView *)collectionView heightForItemAtIndexPath:(NSIndexPath *)indexPath itemWidth:(CGFloat)itemWidth;
@optional

/**
 *  需要显示的列数, 默认3
 */
- (NSInteger)waterflowLayout:(LMJVerticalFlowLayout *)waterflowLayout columnsInCollectionView:(UICollectionView *)collectionView;
/**
 *  列间距, 默认10
 */
- (CGFloat)waterflowLayout:(LMJVerticalFlowLayout *)waterflowLayout columnsMarginInCollectionView:(UICollectionView *)collectionView;
/**
 *  行间距, 默认10
 */
- (CGFloat)waterflowLayout:(LMJVerticalFlowLayout *)waterflowLayout collectionView:(UICollectionView *)collectionView linesMarginForItemAtIndexPath:(NSIndexPath *)indexPath;

/**
 *  距离collectionView四周的间距, 默认{20, 10, 10, 10}
 */
- (UIEdgeInsets)waterflowLayout:(LMJVerticalFlowLayout *)waterflowLayout edgeInsetsInCollectionView:(UICollectionView *)collectionView;


@end



@interface LMJVerticalFlowLayout : UICollectionViewLayout

/** layout的代理 */
- (instancetype)initWithDelegate:(id<LMJVerticalFlowLayoutDelegate>)delegate;

+ (instancetype)flowLayoutWithDelegate:(id<LMJVerticalFlowLayoutDelegate>)delegate;

@end

More Repositories

1

iOSProject

iOS project of collected some demos for iOS App, use Objective-C
Objective-C
5,420
star
2

swiftProject

componented, Target-Action
Swift
42
star
3

vue

Vue入门到实践
Vue
33
star
4

NJSpecs

NJ'S Components Specs. 组建仓库,私有库,组件开发,私有库,组件化私有库
Ruby
19
star
5

Python

Python 从入门到实践 🌲回归初心🌲
Python
4
star
6

NJMediator

Swift Mediator,Mediator,中间件,组件,模块,组件化,模块化,source => https://github.com/NJHu/NJSpecs.git
Swift
3
star
7

NJMediator_DYTrends

DYTrends中间件 "分类" 组件 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
2
star
8

njhu.github.io

个人博客源码: Vue, Webpack, HTML, CSS, JavaScript, Vue+Webpack
JavaScript
2
star
9

HTML5

H5 study notes and codes. notes written by Markdown tool, codes by webStorm.
JavaScript
2
star
10

RN

React Native
JavaScript
1
star
11

CoreText

iOS 比较CoreText 和 TextKit
Swift
1
star
12

NJMediator_NJFAQ

NJFAQ中间件 "分类" 组件 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
13

NJSisVideoList

NJSisVideoList 视频列表 组件化 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
14

NJDYSearchBarView

NJDYSearchBarView 组件化 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
15

emails

swift抓取github上的邮件
1
star
16

NJIJKPlayer

IJKFramework 组件 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
1
star
17

DYLiveRoom

DYLiveRoom 组件化 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
18

DYTrends

DYTrends 组件化 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
19

NJMediator_NJTeachersHelerList

NJTeachersHelerList 课程 中间件 "分类" 组件 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
20

NJDYPlayer

NJDYPlayer 组件化 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
21

NJSisPlayPage

NJSisPlayPage 视频列表播放 组件化 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
22

AttributedAlert

解决产品需求中活动弹框需求
Objective-C
1
star
23

Android

Android第一行代码; 回归初心 💪💪
Java
1
star
24

NJMediator_NJNowShowPlay

NJNowShowPlay中间件 "分类" 组件 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star
25

NJMediator_DYLiveShow

DYLiveShow中间件 "分类" 组件 source => NJSpecs: https://github.com/NJHu/NJSpecs.git
Swift
1
star