Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A UICollectionView which would wrap its content
@interface WrapCollectionView : UICollectionView
@end
@implementation WrapCollectionView
- (void) layoutSubviews
{
[super layoutSubviews];
if (!CGSizeEqualToSize(self.bounds.size, [self intrinsicContentSize]))
{
[self invalidateIntrinsicContentSize];
}
}
- (CGSize)intrinsicContentSize
{
CGSize intrinsicContentSize = self.contentSize;
return intrinsicContentSize;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment