Created
January 11, 2018 13:53
-
-
Save FlyingRadish/796d3ebd32403a4b23b2a568bd47e41e to your computer and use it in GitHub Desktop.
A UICollectionView which would wrap its content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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