// // 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