added contentHugging and compressionResistance
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
22f156d461
commit
b58cfbe175
@ -60,6 +60,10 @@ public final class SelfSizingCollectionView: UICollectionView {
|
||||
// MARK: - Private Methods
|
||||
//--------------------------------------------------
|
||||
private func setupContentSizeObservation() {
|
||||
//ensure autoLayout uses intrinsic height
|
||||
setContentHuggingPriority(.required, for: .vertical)
|
||||
setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
|
||||
// Observing the value of contentSize seems to be the only reliable way to get the contentSize after the collection view lays out its subviews.
|
||||
self.contentSizeObservation = self.observe(\.contentSize, options: [.old, .new]) { [weak self] _, change in
|
||||
// If we don't specify `options: [.old, .new]`, the change.oldValue and .newValue will always be `nil`.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user