Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created Feb 4, 2021
Embed
What would you like to do?
import UIKit
class ViewController: UIViewController {
var labelText = UILabel(frame: .zero)
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(labelText)
labelText.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
labelText.centerYAnchor.constraint(equalTo: view.centerYAnchor),
labelText.centerXAnchor.constraint(equalTo: view.centerXAnchor)
])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment