Last active
October 3, 2021 07:14
-
-
Save danstepanov/b4ebfba03a0cfa00fa12 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
func textFieldConstraints() { | |
// Center Text Field Relative to Page View | |
NSLayoutConstraint( | |
item: textField, | |
attribute: .CenterX, | |
relatedBy: .Equal, | |
toItem: view, | |
attribute: .CenterX, | |
multiplier: 1.0, | |
constant: 0.0) | |
.active = true | |
// Set Text Field Width to be 80% of the Width of the Page View | |
NSLayoutConstraint( | |
item: textField, | |
attribute: .Width, | |
relatedBy: .Equal, | |
toItem: view, | |
attribute: .Width, | |
multiplier: 0.8, | |
constant: 0.0) | |
.active = true | |
// Set Text Field Y Position 10% Down From the Top of the Page View | |
NSLayoutConstraint( | |
item: textField, | |
attribute: .Top, | |
relatedBy: .Equal, | |
toItem: view, | |
attribute: .Bottom, | |
multiplier: 0.1, | |
constant: 0.0) | |
.active = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment