forked from microsoft/WinObjC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUICollectionViewFlowLayout.h
More file actions
124 lines (102 loc) · 5.68 KB
/
UICollectionViewFlowLayout.h
File metadata and controls
124 lines (102 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//******************************************************************************
//
// UICollectionViewFlowLayout.h
// PSPDFKit
//
// Copyright (c) 2012-2013 Peter Steinberger. All rights reserved.
//
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once
#import <UIKit/UICollectionViewLayout.h>
#import <UIKit/UICollectionViewDelegateFlowLayout.h>
#import <UIKit/UIKitExport.h>
UIKIT_EXPORT extern NSString* const UICollectionElementKindSectionHeader;
UIKIT_EXPORT extern NSString* const UICollectionElementKindSectionFooter;
enum _UICollectionViewScrollDirection { UICollectionViewScrollDirectionVertical, UICollectionViewScrollDirectionHorizontal };
typedef NSInteger UICollectionViewScrollDirection;
@class UIGridLayoutInfo;
UIKIT_EXPORT_CLASS
@interface UICollectionViewFlowLayout : UICollectionViewLayout
@property (nonatomic) CGFloat minimumLineSpacing;
@property (nonatomic) CGFloat minimumInteritemSpacing;
@property (nonatomic) CGSize itemSize; // for the cases the delegate method is not implemented
@property (nonatomic) UICollectionViewScrollDirection scrollDirection; // default is UICollectionViewScrollDirectionVertical
@property (nonatomic) CGSize headerReferenceSize;
@property (nonatomic) CGSize footerReferenceSize;
@property (nonatomic) BOOL sectionHeadersPinToVisibleBounds;
@property (nonatomic) BOOL sectionFootersPinToVisibleBounds;
@property (nonatomic) UIEdgeInsets sectionInset;
/*
Row alignment options exits in the official UICollectionView, but hasn't been made public API.
Here's a snippet to test this on UICollectionView:
NSMutableDictionary *rowAlign = [[flowLayout valueForKey:@"_rowAlignmentsOptionsDictionary"] mutableCopy];
rowAlign[@"UIFlowLayoutCommonRowHorizontalAlignmentKey"] = @(1);
rowAlign[@"UIFlowLayoutLastRowHorizontalAlignmentKey"] = @(3);
[flowLayout setValue:rowAlign forKey:@"_rowAlignmentsOptionsDictionary"];
*/
@property (nonatomic, strong) NSDictionary* rowAlignmentOptions;
@end
// @steipete addition, private API in UICollectionViewFlowLayout
UIKIT_EXPORT extern NSString* const UIFlowLayoutCommonRowHorizontalAlignmentKey;
UIKIT_EXPORT extern NSString* const UIFlowLayoutLastRowHorizontalAlignmentKey;
UIKIT_EXPORT extern NSString* const UIFlowLayoutRowVerticalAlignmentKey;
enum _UIFlowLayoutHorizontalAlignment {
UIFlowLayoutHorizontalAlignmentLeft,
UIFlowLayoutHorizontalAlignmentCentered,
UIFlowLayoutHorizontalAlignmentRight,
UIFlowLayoutHorizontalAlignmentJustify // 3; default except for the last row
};
typedef NSInteger UIFlowLayoutHorizontalAlignment;
// TODO: settings for UIFlowLayoutRowVerticalAlignmentKey
/*
@interface UICollectionViewFlowLayout (Private)
- (CGSize)synchronizeLayout;
// For items being inserted or deleted, the collection view calls some different methods, which you should override to provide the
appropriate layout information.
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForFooterInInsertedSection:(NSInteger)section;
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForHeaderInInsertedSection:(NSInteger)section;
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForInsertedItemAtIndexPath:(NSIndexPath *)indexPath;
- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForFooterInDeletedSection:(NSInteger)section;
- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForHeaderInDeletedSection:(NSInteger)section;
- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDeletedItemAtIndexPath:(NSIndexPath *)indexPath;
- (void)_updateItemsLayout;
- (void)_getSizingInfos;
- (void)_updateDelegateFlags;
- (UICollectionViewLayoutAttributes *)layoutAttributesForFooterInSection:(NSInteger)section;
- (UICollectionViewLayoutAttributes *)layoutAttributesForHeaderInSection:(NSInteger)section;
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath usingData:(id)data;
- (UICollectionViewLayoutAttributes *)layoutAttributesForFooterInSection:(NSInteger)section usingData:(id)data;
- (UICollectionViewLayoutAttributes *)layoutAttributesForHeaderInSection:(NSInteger)section usingData:(id)data;
- (id)indexesForSectionFootersInRect:(CGRect)rect;
- (id)indexesForSectionHeadersInRect:(CGRect)rect;
- (id)indexPathsForItemsInRect:(CGRect)rect usingData:(id)arg2;
- (id)indexesForSectionFootersInRect:(CGRect)rect usingData:(id)arg2;
- (id)indexesForSectionHeadersInRect:(CGRect)arg1 usingData:(id)arg2;
- (CGRect)_frameForItemAtSection:(int)arg1 andRow:(int)arg2 usingData:(id)arg3;
- (CGRect)_frameForFooterInSection:(int)arg1 usingData:(id)arg2;
- (CGRect)_frameForHeaderInSection:(int)arg1 usingData:(id)arg2;
- (void)_invalidateLayout;
- (NSIndexPath *)indexPathForItemAtPoint:(CGPoint)arg1;
- (UICollectionViewLayoutAttributes *)_layoutAttributesForItemsInRect:(CGRect)arg1;
- (CGSize)collectionViewContentSize;
- (void)finalizeCollectionViewUpdates;
- (void)_invalidateButKeepDelegateInfo;
- (void)_invalidateButKeepAllInfo;
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)arg1;
- (id)layoutAttributesForElementsInRect:(CGRect)arg1;
- (void)invalidateLayout;
- (id)layoutAttributesForItemAtIndexPath:(id)arg1;
@end
*/