I have a custom UIView subclass which is being initialized via a nib.
In -awakeFromNib
, I\'m creating a subview and attempting to center it in its super
This is an old question but I want to point out this line from the docs:
When developing for iOS 8.0 or later, set the constraint’s isActive property to true instead of calling the addConstraint(_:) method directly. The isActive property automatically adds and removes the constraint from the correct view.
At the very least, this will remove one point of failure since you no longer need to worry about calling addConstraint on the wrong view