Skip to content

Instantly share code, notes, and snippets.

@drance
Created January 16, 2013 09:57
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drance/4546014 to your computer and use it in GitHub Desktop.
Save drance/4546014 to your computer and use it in GitHub Desktop.
Workaround to vanilla UICollectionView+UICollectionViewFlowLayout using non-integral origins, leading to blurry cells.
@implementation BHSCollectionViewFlowLayout
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
NSArray *allAttrs = [super layoutAttributesForElementsInRect:rect];
for (UICollectionViewLayoutAttributes *attributes in allAttrs) {
attributes.frame = CGRectIntegral(attributes.frame);
}
return allAttrs;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment