I have a UICollectionViewController
which generates cells with a random color for testing purposes. Now that the UICollectionViewController
is embedded in a UIScrollView
, I want the scrollView to be the same size as it's contentSize
.
I made a subclass of UICollectionView
, implemented intrinsicContentSize
method, and set the UICollectionView
's class to my custom class in IB. However intrinsicContentSize
never gets called. I have the exact same setup with an UITableView
and there it works flawlessly.
Any ideas on this?
- (CGSize)intrinsicContentSize {
[self layoutIfNeeded];
return CGSizeMake(UIViewNoIntrinsicMetric, self.contentSize.height);
}