# 瀑布流 **Repository Path**: lixinfan/XFWaterfallLayout ## Basic Information - **Project Name**: 瀑布流 - **Description**: No description available - **Primary Language**: Objective-C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-04-22 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #XFWaterfallLayout 一个简单的瀑布流布局 ______ # 使用步骤 ### 导入 将XFWaterfallLayout文件夹中的所有文件添加到项目中 ### 使用 1.导入主头文件 XFWaterfallLayout.h 2.创建XRWaterfallLayout对象,根据需求设置各属性 3.设置代理并实现代理方法或设置itemHeightBlock属性 4.创建collectionView并设置其collectionViewLayout属性为该对象 # 常用属性及方法 1.colCount:每行多少列 2.colMargin:列距 3.rowMargin:行距 4.sectionInset:section与collectionView的间距 5.CGFloat(^itemHeightBlock)(CGFloat, NSIndexPath *):用来计算每个item高度的block # 委托 #### 设置item高度 - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(XFWaterfallFlowLayout *)collectionViewLayout heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath *)indexPath; #### 设置section的Header - (CGSize)collectionView:(UICollectionView *)collectionView layout:(XFWaterfallFlowLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section; #### 设置section的Header - (CGSize)collectionView:(UICollectionView *)collectionView layout:(XFWaterfallFlowLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section;