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
//
// GMCollectionView
// Gengmei
//
// Created by Thierry on 1/9/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import "GMCollectionView.h"
@implementation GMCollectionView
@end
@implementation UICollectionView (Reuse)
- (void)registerHeader:(Class)headerClass {
[self registerClass:headerClass forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:NSStringFromClass(headerClass)];
}
- (void)registerFooter:(Class)footerClass {
[self registerClass:footerClass forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:NSStringFromClass(footerClass)];
}
- (void)registerCell:(Class)cellClass {
[self registerClass:cellClass forCellWithReuseIdentifier:NSStringFromClass(cellClass)];
}
- (UICollectionViewCell *)dequeueCell:(Class)cellClass forIndexPath:(NSIndexPath *)indexPath {
return [self dequeueReusableCellWithReuseIdentifier:NSStringFromClass(cellClass) forIndexPath:indexPath];
}
- (UICollectionReusableView *)dequeueHeader:(Class)headerClass forIndexPath:(NSIndexPath *)indexPath {
return [self dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:NSStringFromClass(headerClass) forIndexPath:indexPath];
}
- (UICollectionReusableView *)dequeueFooter:(Class)footerClass forIndexPath:(NSIndexPath *)indexPath {
return [self dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:NSStringFromClass(footerClass) forIndexPath:indexPath];
}
@end