Last active
August 8, 2017 02:06
-
-
Save TerryCK/707470e71a9e0aab746e1e389828f9c3 to your computer and use it in GitHub Desktop.
constraint.swift
This file contains hidden or 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 redView = UIView() | |
redView.backgroundColor = .red | |
view.addSubview(redView) | |
redView.translatesAutoresizingMaskIntoConstraints = false | |
redView.topAnchor.constraint(equalTo: view.topAnchor, constant: 40).isActive = true | |
redView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -40).isActive = true | |
redView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 40).isActive = true | |
redView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -100).isActive = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment