Skip to content

Instantly share code, notes, and snippets.

@miwillhite
Created November 13, 2014 17:15
Show Gist options
  • Save miwillhite/2af64f27e26ee6b4f323 to your computer and use it in GitHub Desktop.
Save miwillhite/2af64f27e26ee6b4f323 to your computer and use it in GitHub Desktop.
# In my init/setup
// Register the header
[self.collectionView registerClass:[DummyView class]
forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
withReuseIdentifier:kJJUserJujuLibraryHeaderIdentifier];
# This is being called
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout *)collectionViewLayout
referenceSizeForHeaderInSection:(NSInteger)section
{
return CGSizeMake(CGRectGetWidth([UIScreen mainScreen].bounds), 56);
}
# This method is never called
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView
viewForSupplementaryElementOfKind:(NSString *)kind
atIndexPath:(NSIndexPath *)indexPath {
assert(false);
}
@interface DummyView : UICollectionReusableView
@end
@implementation DummyView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if(self) {
self.backgroundColor = [UIColor orangeColor];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment