| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //
- // YBShopLayout.h
- // YBLive
- //
- // Created by ybRRR on 2022/4/19.
- // Copyright © 2022 cat. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- typedef enum {
- YBWaterFlowVerticalEqualWidth = 0, /** 竖向瀑布流 item等宽不等高 */
- YBWaterFlowHorizontalEqualHeight = 1, /** 水平瀑布流 item等高不等宽 不支持头脚视图*/
- YBWaterFlowVerticalEqualHeight = 2, /** 竖向瀑布流 item等高不等宽 */
- YBWaterFlowHorizontalGrid = 3, /** 特为国务院客户端原创栏目滑块样式定制-水平栅格布局 仅供学习交流*/
- YBLineWaterFlow = 4 /** 线性布局 待完成,敬请期待 */
- } YBWaterFlowLayoutStyle; //样式
- @class YBShopLayout;
- @protocol YBShopLayoutDeleaget<UICollectionViewDelegateFlowLayout>
- /**
- 返回item的大小
- 注意:根据当前的瀑布流样式需知的事项:
- 当样式为WSLWaterFlowVerticalEqualWidth 传入的size.width无效 ,所以可以是任意值,因为内部会根据样式自己计算布局
- WSLWaterFlowHorizontalEqualHeight 传入的size.height无效 ,所以可以是任意值 ,因为内部会根据样式自己计算布局
- WSLWaterFlowHorizontalGrid 传入的size宽高都有效, 此时返回列数、行数的代理方法无效,
- WSLWaterFlowVerticalEqualHeight 传入的size宽高都有效, 此时返回列数、行数的代理方法无效
- */
- - (CGSize)waterFlowLayout:(YBShopLayout *)waterFlowLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
- /** 头视图Size */
- -(CGSize )waterFlowLayout:(YBShopLayout *)waterFlowLayout sizeForHeaderViewInSection:(NSInteger)section;
- /** 脚视图Size */
- -(CGSize )waterFlowLayout:(YBShopLayout *)waterFlowLayout sizeForFooterViewInSection:(NSInteger)section;
- @optional //以下都有默认值
- /** 列数*/
- -(CGFloat)columnCountInWaterFlowLayout:(YBShopLayout *)waterFlowLayout;
- /** 行数*/
- -(CGFloat)rowCountInWaterFlowLayout:(YBShopLayout *)waterFlowLayout;
- /** 列间距*/
- -(CGFloat)columnMarginInWaterFlowLayout:(YBShopLayout *)waterFlowLayout;
- /** 行间距*/
- -(CGFloat)rowMarginInWaterFlowLayout:(YBShopLayout *)waterFlowLayout;
- /** 边缘之间的间距*/
- -(UIEdgeInsets)edgeInsetInWaterFlowLayout:(YBShopLayout *)waterFlowLayout;
- @end
- @interface YBShopLayout : UICollectionViewLayout
- @property (nonatomic, weak) id<YBShopLayoutDeleaget> delegate;
- /** 瀑布流样式*/
- @property (nonatomic, assign) YBWaterFlowLayoutStyle flowLayoutStyle;
- @end
|