ZJCollectionLayout 布局

ZJCollectionLayout是UICollectionView的一个自定义布局,它允许设置不同宽度的Item,并处理Item之间的列间距、行间距以及与collectionView边缘的间距。布局通过代理方法获取Item的大小并计算其位置,支持自动换行。
摘要由CSDN通过智能技术生成

不同宽度Item布局

 

#import <UIKit/UIKit.h>

 

NS_ASSUME_NONNULL_BEGIN

@class ZJCollectionLayout;

 

@protocol ZJCollectionLayoutDelegate <NSObject>

/** */

- (CGSize)flowLayout:(ZJCollectionLayout *) layout itemSizeForItemAtIndexPath:(NSIndexPath*)indexPath;

/** 每一列item之间的间距*/

- (CGFloat)itemColumnMarginInFlowLayout:(ZJCollectionLayout *) layout;

/** 每一行item之间的间距*/

- (CGFloat)itemRowMarginInFlowLayout:(ZJCollectionLayout *) layout;

/** 设置于collectionView边缘的间距*/

- (UIEdgeInsets)itemSectionInsetMarginInFlowLayout:(ZJCollectionLayout *) layout;

@end

 

@interface ZJCollectionLayout : UICollectionViewLayout

@property (nonatomic,weak) id<ZJCollectionLayoutDelegate> delegate;

@end

 

NS_ASSUME_NONNULL_END

 

#import "ZJCollectionLayout.h"

@interface ZJ

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值