SYStickHeaderWaterFall
Help you easily complete UICollectionView layout such as waterfalls flow and the header to stay and so on
Install / Use
/learn @zhangsuya/SYStickHeaderWaterFallREADME
SYStickHeaderWaterFall 中文介绍
More flexible support various types of waterfalls flow .(更加灵活支持各种类型的瀑布流结构。)

以后封装任务: 1.装饰视图的增加。
安装
CocoaPods
- 将 cocoapods 更新至最新版本.
- 在 Podfile 中添加
pod "SYStickHeaderWaterFall"。 - 执行
pod install或pod update。
(usage) 用法
(init and set delegate) 初始化并设置delegate:
SYStickHeaderWaterFallLayout *cvLayout = [[SYStickHeaderWaterFallLayout alloc] init];
cvLayout.delegate = self;
(set property) 设置属性:
//是否设置sectionHeader停留,默认YES
cvLayout.isStickyHeader = YES;
//是否设置Footer停留,默认NO
cvLayout.isStickyFooter = NO;
//section停留的位置是否包括原来设置的top,默认NO
cvLayout.isTopForHeader = YES;
//当你用UINavigationController和UITabbarViewController并设置一些属性时,collectionview的展示视图的坐标y会变得很奇怪,那就在此修正,默认64
cvLayout.fixTop = 64.0f;
(implement delegate method) 实现代理方法:
// 返回所在section的每个item的width(一个section只有一个width)
- (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
widthForItemInSection:( NSInteger )section;
// 返回所在indexPath的每个item的height(每个item有一个height,要不然怎么是瀑布流😄)
- (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
heightForItemAtIndexPath:(nonnull NSIndexPath *)indexPath;
@optional
// 返回所在indexPath的header的height
- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
heightForHeaderAtIndexPath:(nonnull NSIndexPath *)indexPath;
// 返回所在indexPath的footer的height
- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
heightForFooterAtIndexPath:(nonnull NSIndexPath *)indexPath;
// 返回所在section与上一个section的间距(表达的可能不够准确,但是你们都懂的)
- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
topInSection:(NSInteger )section;
// 返回所在section与下一个section的间距(表达的可能不够准确,但是你们都懂的)
- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
bottomInSection:( NSInteger)section;
// 返回所在section的header停留时与顶部的距离(如果设置isTopForHeader = yes ,则距离会叠加)
- (CGFloat) collectionView:(nonnull UICollectionView *)collectionView
layout:(nonnull SYStickHeaderWaterFallLayout *)collectionViewLayout
headerToTopInSection:( NSInteger)section;
另
有什么问题可以邮箱联系我,或者issue我。也可以加交流群:436043199
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
