Created
October 5, 2019 05:18
-
-
Save laevandus/ec5f922aa7edb3c00d8a0f722c28db35 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
let customView = CustomView(frame: .zero) // view with intrinsicContentSize | |
customView.translatesAutoresizingMaskIntoConstraints = false | |
scrollView.addSubview(customView) | |
NSLayoutConstraint.activate([ | |
customView.leadingAnchor.constraint(equalTo: scrollView.contentLayoutGuide.leadingAnchor), | |
customView.trailingAnchor.constraint(equalTo: scrollView.contentLayoutGuide.trailingAnchor), | |
customView.topAnchor.constraint(equalTo: scrollView.contentLayoutGuide.topAnchor), | |
customView.bottomAnchor.constraint(equalTo: scrollView.contentLayoutGuide.bottomAnchor), | |
customView.widthAnchor.constraint(equalTo: scrollView.widthAnchor) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment