CHTCollectionViewWaterfallLayout
===============================
[![Version](https://cocoapod-badges.herokuapp.com/v/CHTCollectionViewWaterfallLayout/badge.png)](http://cocoadocs.org/docsets/CHTCollectionViewWaterfallLayout)
[![Platform](https://cocoapod-badges.herokuapp.com/p/CHTCollectionViewWaterfallLayout/badge.png)](http://cocoadocs.org/docsets/CHTCollectionViewWaterfallLayout)
[![Build Status](https://travis-ci.org/chiahsien/CHTCollectionViewWaterfallLayout.svg?branch=develop)](https://travis-ci.org/chiahsien/CHTCollectionViewWaterfallLayout)
**CHTCollectionViewWaterfallLayout** is a subclass of [UICollectionViewLayout], and it trys to imitate [UICollectionViewFlowLayout]'s usage as much as possible.
This layout is inspired by [Pinterest]. It also is compatible with [PSTCollectionView].
Screen Shots
------------
![2 columns](https://cloud.githubusercontent.com/assets/474/3419095/25b4de9e-fe56-11e3-9b98-690319d736ce.png)
Features
--------
* Easy to use, it trys to imitate [UICollectionViewFlowLayout]'s usage as much as possible.
* Highly customizable.
* Outstanding performance, try 10,000+ items and see the smoothness for yourself.
* Support header and footer views.
Prerequisite
------------
* ARC
* Xcode 4.4+, which supports literals syntax.
* iOS 6+, or
* iOS 4.x/5.x, with [PSTCollectionView].
How to install
--------------
* [CocoaPods]
Add `pod 'CHTCollectionViewWaterfallLayout'` to your podfile.
* Manual
Copy `CHTCollectionViewWaterfallLayout.h/m` to your project.
How to Use
----------
Read the demo codes and `CHTCollectionViewWaterfallLayout.h` header file for more information.
#### Step 1
Below lists the properties for you to customize the layout. Although they have default values, I strongly recommand you to set up at least the `columnCount` property to suit your needs.
The `itemRenderDirection` property is an enum which decides the order in which your items will be rendered in subsequent rows. For eg. Left-Right | Right-Left | Shortest column filling up first.
``` objc
@property (nonatomic, assign) NSInteger columnCount;
@property (nonatomic, assign) CGFloat minimumColumnSpacing;
@property (nonatomic, assign) CGFloat minimumInteritemSpacing;
@property (nonatomic, assign) CGFloat headerHeight;
@property (nonatomic, assign) CGFloat footerHeight;
@property (nonatomic, assign) UIEdgeInsets sectionInset;
@property (nonatomic, assign) ItemRenderDirection itemRenderDirection;
```
#### Step 2
Your collection view's delegate (which often is your view controller) must conforms to `CHTCollectionViewDelegateWaterfallLayout` protocol and implements the required method, all you need to do is return the original size of the item:
``` objc
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
```
#### Step 3 (Optional)
If you need to support iOS 4.x/5.x and you have installed [PSTCollectionView], then you **NEED** to modify some codes.
Quoted from [PSTCollectionView] README file:
> **If you want to have PSTCollectionView on iOS4.3/5.x and UICollectionView on iOS6, use PSUICollectionView (basically add PS on any UICollectionView* class to get auto-support for older iOS versions)**
> If you always want to use PSTCollectionView, use PSTCollectionView as class names. (replace the UI with PST)
Limitation
----------
* Only vertical scrolling is supported.
* No decoration view.
Who is using it
---------------
Please let me know if your app is using this library. I'm glad to put your app on the list :-)
* [F3PiX](https://itunes.apple.com/us/app/samenwerken-f3pix/id897714553?mt=8)
F3PiX is a series of apps which gives you a concise, curated collection of pictures by professional (Dutch) photographers according to a specific theme. You can use the pictures freely for your own work.
License
-------
CHTCollectionViewWaterfallLayout is available under the MIT license. See the LICENSE file for more info.
Changelog
---------
Refer to the [Releases page](https://github.com/chiahsien/CHTCollectionViewWaterfallLayout/releases).
[UICollectionViewLayout]: http://developer.apple.com/library/ios/#documentation/uikit/reference/UICollectionViewLayout_class/Reference/Reference.html
[UICollectionViewFlowLayout]: https://developer.apple.com/library/ios/documentation/uikit/reference/UICollectionViewFlowLayout_class/Reference/Reference.html
[Pinterest]: http://pinterest.com/
[PSTCollectionView]: https://github.com/steipete/PSTCollectionView
[CocoaPods]: http://cocoapods.org/
没有合适的资源?快使用搜索试试~ 我知道了~
collectionview 实现的瀑布流(IOS )
共38个文件
m:7个
h:6个
png:4个
5星 · 超过95%的资源 需积分: 9 114 下载量 144 浏览量
2014-08-06
14:03:09
上传
评论 2
收藏 2.8MB ZIP 举报
温馨提示
collectionview 实现的瀑布流(IOS ) 效果很不错,大家可以研究研究!
资源推荐
资源详情
资源评论
收起资源包目录
CHTCollectionViewWaterfallLayout-develop 3.zip (38个子文件)
CHTCollectionViewWaterfallLayout-develop 3
.travis.yml 123B
CHTCollectionViewWaterfallLayout.m 16KB
CHTCollectionViewWaterfallLayout.podspec 682B
CHTCollectionViewWaterfallLayout.swift 15KB
Demo
Demo.xcodeproj
project.xcworkspace
contents.xcworkspacedata 149B
xcuserdata
yujun.xcuserdatad
UserInterfaceState.xcuserstate 12KB
project.pbxproj 18KB
xcuserdata
yujun.xcuserdatad
xcschemes
xcschememanagement.plist 337B
xcshareddata
xcschemes
Demo.xcscheme 3KB
Demo
main.m 327B
CHTCollectionViewWaterfallHeader.h 255B
Default.png 6KB
images
cat4.jpg 191KB
cat1.jpg 190KB
cat2.jpg 517KB
cat3.jpg 336KB
CHTCollectionViewWaterfallFooter.h 255B
AppDelegate.h 268B
AppDelegate.m 2KB
Default-568h@2x.png 18KB
CHTCollectionViewWaterfallHeader.m 428B
CHTCollectionViewWaterfallFooter.m 429B
CHTCollectionViewWaterfallCell.h 355B
Default@2x.png 16KB
ViewController.h 394B
CHTCollectionViewWaterfallCell.m 2KB
Demo-Info.plist 2KB
ViewController.m 5KB
en.lproj
MainStoryboard_iPhone.storyboard 2KB
InfoPlist.strings 45B
Demo-Prefix.pch 311B
.DS_Store 6KB
LICENSE 1KB
.DS_Store 6KB
CHTCollectionViewWaterfallLayout.h 11KB
Screenshots
2-columns.png 1.54MB
.gitignore 232B
README.md 4KB
共 38 条
- 1
菜___鸟
- 粉丝: 7
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页