Skip to content

Commit 025939f

Browse files
committed
Merge branch 'release/0.8'
2 parents 00d070d + 8322f77 commit 025939f

15 files changed

Lines changed: 2161 additions & 50 deletions

CHTCollectionViewWaterfallLayout.h

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77

88
#import <UIKit/UIKit.h>
99

10+
/**
11+
* Enumerated structure to define direction in which items can be rendered.
12+
*/
13+
typedef NS_ENUM (NSUInteger, CHTCollectionViewWaterfallLayoutItemRenderDirection) {
14+
CHTCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst,
15+
CHTCollectionViewWaterfallLayoutItemRenderDirectionLeftToRight,
16+
CHTCollectionViewWaterfallLayoutItemRenderDirectionRightToLeft
17+
};
18+
1019
/**
1120
* Constants that specify the types of supplementary views that can be presented using a waterfall layout.
1221
*/
@@ -46,6 +55,21 @@ extern NSString *const CHTCollectionElementKindSectionFooter;
4655
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
4756

4857
@optional
58+
/**
59+
* Asks the delegate for the column count in a section
60+
*
61+
* @param collectionView
62+
* The collection view object displaying the waterfall layout.
63+
* @param collectionViewLayout
64+
* The layout object requesting the information.
65+
* @param section
66+
* The section.
67+
*
68+
* @return
69+
* The original column count for that section. Must be greater than 0.
70+
*/
71+
- (NSInteger)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout columnCountForSection:(NSInteger)section;
72+
4973
/**
5074
* Asks the delegate for the height of the header view in the specified section.
5175
*
@@ -106,6 +130,42 @@ extern NSString *const CHTCollectionElementKindSectionFooter;
106130
*/
107131
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section;
108132

133+
/**
134+
* Asks the delegate for the header insets in the specified section.
135+
*
136+
* @param collectionView
137+
* The collection view object displaying the waterfall layout.
138+
* @param collectionViewLayout
139+
* The layout object requesting the information.
140+
* @param section
141+
* The index of the section whose header insets are being requested.
142+
*
143+
* @discussion
144+
* If you do not implement this method, the waterfall layout uses the value in its headerInset property.
145+
*
146+
* @return
147+
* The headerInsets for the section.
148+
*/
149+
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForHeaderInSection:(NSInteger)section;
150+
151+
/**
152+
* Asks the delegate for the footer insets in the specified section.
153+
*
154+
* @param collectionView
155+
* The collection view object displaying the waterfall layout.
156+
* @param collectionViewLayout
157+
* The layout object requesting the information.
158+
* @param section
159+
* The index of the section whose footer insets are being requested.
160+
*
161+
* @discussion
162+
* If you do not implement this method, the waterfall layout uses the value in its footerInset property.
163+
*
164+
* @return
165+
* The footerInsets for the section.
166+
*/
167+
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForFooterInSection:(NSInteger)section;
168+
109169
/**
110170
* Asks the delegate for the minimum spacing between two items in the same column
111171
* in the specified section. If this method is not implemented, the
@@ -185,6 +245,28 @@ extern NSString *const CHTCollectionElementKindSectionFooter;
185245
*/
186246
@property (nonatomic, assign) CGFloat footerHeight;
187247

248+
/**
249+
* @brief The margins that are used to lay out the header for each section.
250+
* @discussion
251+
* These insets are applied to the headers in each section.
252+
* They represent the distance between the top of the collection view and the top of the content items
253+
* They also indicate the spacing on either side of the header. They do not affect the size of the headers or footers themselves.
254+
*
255+
* Default: UIEdgeInsetsZero
256+
*/
257+
@property (nonatomic, assign) UIEdgeInsets headerInset;
258+
259+
/**
260+
* @brief The margins that are used to lay out the footer for each section.
261+
* @discussion
262+
* These insets are applied to the footers in each section.
263+
* They represent the distance between the top of the collection view and the top of the content items
264+
* They also indicate the spacing on either side of the footer. They do not affect the size of the headers or footers themselves.
265+
*
266+
* Default: UIEdgeInsetsZero
267+
*/
268+
@property (nonatomic, assign) UIEdgeInsets footerInset;
269+
188270
/**
189271
* @brief The margins that are used to lay out content in each section.
190272
* @discussion
@@ -196,10 +278,20 @@ extern NSString *const CHTCollectionElementKindSectionFooter;
196278
*/
197279
@property (nonatomic, assign) UIEdgeInsets sectionInset;
198280

281+
/**
282+
* @brief The direction in which items will be rendered in subsequent rows.
283+
* @discussion
284+
* The direction in which each item is rendered. This could be left to right (CHTCollectionViewWaterfallLayoutItemRenderDirectionLeftToRight), right to left (CHTCollectionViewWaterfallLayoutItemRenderDirectionRightToLeft), or shortest column fills first (CHTCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst).
285+
*
286+
* Default: CHTCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst
287+
*/
288+
@property (nonatomic, assign) CHTCollectionViewWaterfallLayoutItemRenderDirection itemRenderDirection;
289+
199290
/**
200291
* @brief The calculated width of an item in the specified section.
201292
* @discussion
202293
* The width of an item is calculated based on number of columns, the collection view width, and the horizontal insets for that section.
203294
*/
204295
- (CGFloat)itemWidthInSectionAtIndex:(NSInteger)section;
296+
205297
@end

0 commit comments

Comments
 (0)