I am using autolayout and storyboards. I try to change the constraint in viewDidLoad: so that it takes into account different device models. The constraint is successfully connected as IBOutlet.
In viewDidLoad: I change the constraint like this:
self.containerConstraint.constant = 250
I DO NOT want to animate the constraint (I later animate it and it works fine). I only want to it to set the view that is constraining to the right spot when the viewController appears. This usually works, however in this case, it persist to use the value determined in storyboard. This is how constraint looks:
What should I do?
See that wR hR
option under Constant
? That was the problem. Looks like constraints that use size classes cant be set in viewDidLoad.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With