微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

GXWaterCollectionViewLayout 可设置纵横方向和排列数的瀑布流布局

程序名称:GXWaterCollectionViewLayout

授权协议: MIT

操作系统: 跨平台

开发语言: Objective-C

GXWaterCollectionViewLayout 介绍

GXWaterCollectionViewLayout 是一个好用的瀑布流布局,可以设置纵横方向和排列数等。

  • iOS 7.0 or later

  • Xcode 8.0 or later

pod 'GXWaterCollectionViewLayout'
@property (nonatomic, assign) UICollectionViewScrollDirection scrollDirection;  //滚动方向
@property (nonatomic, assign) NSInteger    numberOfColumns;   //瀑布流横排数
@property (nonatomic, assign) CGFloat      linespacing;       //纵向间距
@property (nonatomic, assign) CGFloat      interitemSpacing;  //横向间距
@property (nonatomic, assign) CGSize       headerSize;        //页眉尺寸
@property (nonatomic, assign) CGSize       footerSize;        //页脚尺寸
@property (nonatomic, assign) UIEdgeInsets sectionInset;      //分类inset
// 初始化瀑布流布局
self.waterLayout = [[GXWaterCollectionViewLayout alloc] init];
self.waterLayout.numberOfColumns = 4;
self.waterLayout.linespacing = 10.0;
self.waterLayout.interitemSpacing = 10.0;
self.waterLayout.sectionInset = UIEdgeInsetsMake(20, 20, 20, 20);
self.waterLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.waterLayout.headerSize = CGSizeMake(self.view.bounds.size.width, 40);
self.waterLayout.footerSize = CGSizeMake(self.view.bounds.size.width, 40);
self.waterLayout.delegate = self;
// 初始化UICollectionView
self.waterCollectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:self.waterLayout];
self.waterCollectionView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.waterCollectionView.backgroundColor = [UIColor whiteColor];
self.waterCollectionView.delegate = self;
self.waterCollectionView.dataSource = self;
[self.view addSubview:self.waterCollectionView];

GXWaterCollectionViewLayout 官网

https://github.com/gsyhei/GXWaterCollectionViewLayout

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐