Created
September 26, 2020 15:45
-
-
Save yabenatti/d0d0da2f48a72e26c5995d0d350dee97 to your computer and use it in GitHub Desktop.
Anchors Constraints
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 func setupAnchorConstraints() { | |
view.addSubview(titleLabel) | |
view.addSubview(hiButton) | |
titleLabel.topAnchor.constraint(equalTo: view.topAnchor, constant: 20).isActive = true | |
titleLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20).isActive = true | |
titleLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20).isActive = true | |
hiButton.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 8).isActive = true | |
hiButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20).isActive = true | |
hiButton.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20).isActive = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment