Please explain the difference. I watch the lesson on YouTube (LINK)
The guy uses viewDidLayoutSubviews when he could have used NSLayoutConstraint.
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
firstNameField.frame = CGRect(x: 30,
y: imageView.bottom+10,
width: scrollView.width-60,
height: 52)
}
example NSLayoutConstraint.activate
NSLayoutConstraint.activate([
firstNameField.heightAnchor.constraint(equalToConstant: 52),
firstNameField.bottomAnchor.constraint(equalTo: imageView.bottomAnchor, constant: -10),
and e.t.c
])
I haven't used viewDidLayoutSubviews before, which is the right approach?