I try to set up a view with AutoLayout constraints by using constraintEqualToAnchor()
:
override func viewDidLoad() {
super.viewDidLoad()
le
// method myView.topAnchor.constraintEqualToAnchor creates new one inactive anchor
// and not returns exist with equal relationships
// you can set identifier for any constraint in Interface Builder or code and find & update in code
for ( NSLayoutConstraint *c in [self.view constraintsAffectingLayoutForAxis:UILayoutConstraintAxisHorizontal] )
{
if ( YES == [c.identifier isEqualToString:@"my.layout-constraint.id"] )
{
// Unlike the other properties, the constant can be modified
// after constraint creation.
// Setting the constant on an existing constraint performs much better
// than removing the constraint and adding a new one that's exactly like
// the old except that it has a different constant.
c.constant = 123;
// if needed
// [self.view setNeedsUpdateConstraints];
break;
}
}