Created
August 1, 2021 05:36
-
-
Save laevandus/e42b649a20e2bb9a84e629dc0ff9b43b to your computer and use it in GitHub Desktop.
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
private var collectionViewHeightConstraint: NSLayoutConstraint! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
collectionView.register(TextCollectionViewCell.self, forCellWithReuseIdentifier: Self.reuseIdentifier) | |
collectionView.backgroundColor = UIColor(white: 0.9, alpha: 1) | |
collectionView.isScrollEnabled = false | |
collectionViewHeightConstraint = collectionView.heightAnchor.constraint(equalToConstant: 50) | |
collectionViewHeightConstraint.isActive = true | |
} | |
override func viewWillLayoutSubviews() { | |
super.viewWillLayoutSubviews() | |
collectionViewHeightConstraint.constant = collectionViewLayout.collectionViewContentSize.height | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment