You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.4 KiB

//
// WSLWaterFlowLayout.h
// zzjk
//
// Created by 沙狐 on 2020/6/11.
// Copyright © 2020 沙狐. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef enum {
WSLWaterFlowVerticalEqualWidth = 0, /** 竖向瀑布流 item等宽不等高 */
WSLWaterFlowHorizontalEqualHeight = 1, /** 水平瀑布流 item等高不等宽 不支持头脚视图*/
WSLWaterFlowVerticalEqualHeight = 2, /** 竖向瀑布流 item等高不等宽 */
WSLWaterFlowHorizontalGrid = 3, /** 特为国务院客户端原创栏目滑块样式定制-水平栅格布局 仅供学习交流*/
WSLLineWaterFlow = 4 /** 线性布局 待完成,敬请期待 */
} WSLWaterFlowLayoutStyle; //样式
@class WSLWaterFlowLayout;
@protocol WSLWaterFlowLayoutDelegate <NSObject>
/**
item的大小
WSLWaterFlowVerticalEqualWidth size.width无效
WSLWaterFlowHorizontalEqualHeight size.height无效
WSLWaterFlowHorizontalGrid size宽高都有效
WSLWaterFlowVerticalEqualHeight size宽高都有效
*/
- (CGSize)waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
/** 头视图Size */
-(CGSize )waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout sizeForHeaderViewInSection:(NSInteger)section;
/** 脚视图Size */
-(CGSize )waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout sizeForFooterViewInSection:(NSInteger)section;
@optional //以下都有默认值
/** 列数*/
-(CGFloat)columnCountInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout;
/** 行数*/
-(CGFloat)rowCountInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout;
/** 列间距*/
-(CGFloat)columnMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout;
/** 行间距*/
-(CGFloat)rowMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout;
/** 边缘之间的间距*/
-(UIEdgeInsets)edgeInsetInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout;
@end
@interface WSLWaterFlowLayout : UICollectionViewLayout
/** delegate*/
@property (nonatomic, weak) id<WSLWaterFlowLayoutDelegate> delegate;
/** 瀑布流样式*/
@property (nonatomic, assign) WSLWaterFlowLayoutStyle flowLayoutStyle;
@end