forked from darrarski/DRCollectionViewTableLayout-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDRCollectionViewTableLayoutManager.h
244 lines (221 loc) · 9.32 KB
/
DRCollectionViewTableLayoutManager.h
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
//
// DRCollectionViewTableLayoutManager.h
// DRCollectionViewTableLayout
//
// Created by Dariusz Rybicki on 09.05.2014.
// Copyright (c) 2014 Darrarski. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "DRCollectionViewTableLayout.h"
@class DRCollectionViewTableLayoutManager;
/**
* Collection View Table Layout Manager Delegate
*/
@protocol DRCollectionViewTableLayoutManagerDelegate <NSObject>
/**
* Return number of sections in given collection view
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
*
* @return Number of sections
*/
- (NSUInteger)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
numberOfSectionsInCollectionView:(UICollectionView *)collectionView;
/**
* Return number of layout's columns in given collection view section
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param section Collection View section
*
* @return Number of layout's columns
*/
- (NSUInteger)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
numberOfColumnsInSection:(NSUInteger)section;
/**
* Return number of layout's rows in given collection view section
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param section Collection View section
*
* @return Number of layout's rows
*/
- (NSUInteger)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
numberOfRowsInSection:(NSUInteger)section;
/**
* Return width for layout's column in given collection view section
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param column Layout's column index
* @param section Collection View section
*
* @return Column width
*/
- (CGFloat)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
widthForColumn:(NSUInteger)column
inSection:(NSUInteger)section;
/**
* Return height for layout's row in given collection view section
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param row Layout's row index
* @param section Collection View section
*
* @return Row height
*/
- (CGFloat)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
heightForRow:(NSUInteger)row
inSection:(NSUInteger)section;
/**
* Return cell for given row and column in collection view
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param row Layout's row
* @param column Layout's column
* @param indexPath Collection View Cell index path
*
* @return Collection View Cell
*/
- (UICollectionViewCell *)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
cellForRow:(NSUInteger)row
column:(NSUInteger)column
indexPath:(NSIndexPath *)indexPath;
@optional
/**
* Return width for row headers. Return 0 to disable row headers.
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param section Collection View section
*
* @return Row headers width
*/
- (CGFloat)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
widthForRowHeaderInSection:(NSUInteger)section;
/**
* Return height for column headers. Return 0 to disable column headers.
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param section Collection View section
*
* @return Column headers height
*/
- (CGFloat)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
heightForColumnHeaderInSection:(NSUInteger)section;
/**
* Return view for column header
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param column Layout's column
* @param indexPath Collection View Supplementary View index path
*
* @return Collection Reusable View
*/
- (UICollectionReusableView *)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
headerViewForColumn:(NSUInteger)column
indexPath:(NSIndexPath *)indexPath;
/**
* Return view for row header
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param row Layout's row
* @param indexPath Collection View Supplementary View index path
*
* @return Collection Reusable View
*/
- (UICollectionReusableView *)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
headerViewForRow:(NSUInteger)row
indexPath:(NSIndexPath *)indexPath;
/**
* Return YES if row headers in given section should stick to left edge
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param section Collection View section
*
* @return Boolean value
*/
- (BOOL)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
stickyRowHeadersForSection:(NSUInteger)section;
/**
* Return YES if column headers in given section should stick to top edge
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param section Collection View section
*
* @return Boolean value
*/
- (BOOL)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
stickyColumnHeadersForSection:(NSUInteger)section;
/**
* Will be called when user selects cell
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param row Layout's row
* @param column Layout's column
* @param indexPath Collection View Cell index path
*/
- (void)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
didSelectCellAtRow:(NSUInteger)row
column:(NSUInteger)column
indexPath:(NSIndexPath *)indexPath;
/**
* Will be called when user deselects cell
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param row Layout's row
* @param column Layout's column
* @param indexPath Collection View Cell index path
*/
- (void)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
didDeselectCellAtRow:(NSUInteger)row
column:(NSUInteger)column
indexPath:(NSIndexPath *)indexPath;
/**
* Will be called in order to decide if the cell has to be selected or not
*
* @param manager Collection View Table Layout Manager
* @param collectionView Collection View
* @param row Layout's row
* @param column Layout's column
* @param indexPath Collection View Cell index path
*/
- (BOOL)collectionViewTableLayoutManager:(DRCollectionViewTableLayoutManager *)manager
collectionView:(UICollectionView *)collectionView
shouldSelectItemAtRow:(NSUInteger)row
column:(NSUInteger)column
indexPath:(NSIndexPath *)indexPath;
@end
/**
* Collection View Table Layout Manager
*/
@interface DRCollectionViewTableLayoutManager : NSObject <UICollectionViewDataSource, DRCollectionViewTableLayoutDelegate, UICollectionViewDelegate>
/**
* Collection View Table Layout Manager Delegate
*/
@property (weak, nonatomic) id<DRCollectionViewTableLayoutManagerDelegate> delegate;
@end