Skip to content

Instantly share code, notes, and snippets.

@levi
Created August 11, 2015 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levi/c48d229576a6bc316b75 to your computer and use it in GitHub Desktop.
Save levi/c48d229576a6bc316b75 to your computer and use it in GitHub Desktop.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
[layout prepareLayout];
CGSize size = [layout collectionViewContentSize];
CGRect rect = CGRectMake(0, 0, size.width, size.height);
NSArray *layoutAttributes = [layout layoutAttributesForElementsInRect:rect];
for (UICollectionViewLayoutAttributes *attributes in layoutAttributes) {
switch (attributes.representedElementCategory) {
case UICollectionElementCategoryCell:
NSLog(@"Cell");
break;
case UICollectionElementCategorySupplementaryView:
NSLog(@"Supplementary View");
break;
case UICollectionElementCategoryDecorationView:
NSLog(@"Decoration View");
break;
}
NSLog(@"Kind: %@", attributes.representedElementKind);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment