This repository was archived by the owner on Oct 10, 2018. It is now read-only.
File tree 2 files changed +65
-0
lines changed
DRCollectionViewTableLayout
2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change 199
199
column : (NSUInteger )column
200
200
indexPath : (NSIndexPath *)indexPath ;
201
201
202
+ /* *
203
+ * Will be called when user deselects cell
204
+ *
205
+ * @param manager Collection View Table Layout Manager
206
+ * @param collectionView Collection View
207
+ * @param row Layout's row
208
+ * @param column Layout's column
209
+ * @param indexPath Collection View Cell index path
210
+ */
211
+ - (void )collectionViewTableLayoutManager : (DRCollectionViewTableLayoutManager *)manager
212
+ collectionView : (UICollectionView *)collectionView
213
+ didDeselectCellAtRow : (NSUInteger )row
214
+ column : (NSUInteger )column
215
+ indexPath : (NSIndexPath *)indexPath ;
216
+
217
+ /* *
218
+ * Will be called in order to decide if the cell has to be selected or not
219
+ *
220
+ * @param manager Collection View Table Layout Manager
221
+ * @param collectionView Collection View
222
+ * @param row Layout's row
223
+ * @param column Layout's column
224
+ * @param indexPath Collection View Cell index path
225
+ */
226
+ - (BOOL )collectionViewTableLayoutManager : (DRCollectionViewTableLayoutManager *)manager
227
+ collectionView : (UICollectionView *)collectionView
228
+ shouldSelectItemAtRow : (NSUInteger )row
229
+ column : (NSUInteger )column
230
+ indexPath : (NSIndexPath *)indexPath ;
231
+
202
232
@end
203
233
204
234
/* *
Original file line number Diff line number Diff line change @@ -189,4 +189,39 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
189
189
}
190
190
}
191
191
192
+
193
+ - (void )collectionView : (UICollectionView *)collectionView didDeselectItemAtIndexPath : (NSIndexPath *)indexPath {
194
+ NSUInteger row = [(DRCollectionViewTableLayout *)collectionView.collectionViewLayout rowNumberForIndexPath: indexPath];
195
+ NSUInteger column = [(DRCollectionViewTableLayout *)collectionView.collectionViewLayout columnNumberForIndexPath: indexPath];
196
+
197
+ SEL selector = @selector (collectionViewTableLayoutManager:collectionView:didDeselectCellAtRow:column:indexPath: );
198
+
199
+ if ([self .delegate respondsToSelector: selector]) {
200
+
201
+ [self .delegate collectionViewTableLayoutManager: self
202
+ collectionView: collectionView
203
+ didDeselectCellAtRow: row
204
+ column: column
205
+ indexPath: indexPath];
206
+ }
207
+ }
208
+
209
+ - (BOOL )collectionView : (UICollectionView *)collectionView shouldSelectItemAtIndexPath : (NSIndexPath *)indexPath {
210
+ NSUInteger row = [(DRCollectionViewTableLayout *)collectionView.collectionViewLayout rowNumberForIndexPath: indexPath];
211
+ NSUInteger column = [(DRCollectionViewTableLayout *)collectionView.collectionViewLayout columnNumberForIndexPath: indexPath];
212
+
213
+ SEL selector = @selector (collectionViewTableLayoutManager:collectionView:shouldSelectItemAtRow:column:indexPath: );
214
+
215
+ if ([self .delegate respondsToSelector: selector]) {
216
+
217
+ return [self .delegate collectionViewTableLayoutManager: self
218
+ collectionView: collectionView
219
+ shouldSelectItemAtRow: row
220
+ column: column
221
+ indexPath: indexPath];
222
+ }
223
+
224
+ return YES ;
225
+ }
226
+
192
227
@end
You can’t perform that action at this time.
0 commit comments