Я бы хотел, чтобы UICollectionView (красный) уменьшался до высоты размера содержимого, в данном случае UICollectionViewCells (желтые), потому что там много пустого места. Я попробовал использовать:
Код: Выделить всё
override func layoutSubviews() {
super.layoutSubviews()
if !__CGSizeEqualToSize(bounds.size, self.intrinsicContentSize) {
self.invalidateIntrinsicContentSize()
}
}
override var intrinsicContentSize: CGSize {
return self.collection.contentSize
}
and for this reason it shrinks too much to value of height 30 (The value which I set in the XIB file for the height, although I have constaint >= 30).

Источник: https://stackoverflow.com/questions/424 ... nt-size-of