I've made a constraint in my storyboard and connected to a variable in my view controller. In updateViewConstraints
I set the constraint's active
property to false.
When I do
self.view.setNeedsUpdateConstraints()
self.view.layoutIfNeeded()
in viewDidLoad
, layoutIfNeeded
calls updateViewConstraints
which sets the constraint to not active, but then somewhere after this it sets the constraint to active and then UIViewAlertForUnsatisfiableConstraints
symbolic breakpoint is hit due to conflict with my other constraints. When I check the value of .active
further up the stack at this breakpoint it is true
.
This only happens in viewDidLoad
. Before the view is displayed on the screen updateViewConstraints
is called again, and this time setting the constraint to not active sticks and the layout is correct. I still get the conflicting constraints error in the console. Is this a bug?
Edit: Here's the stack trace leading to setting the constraint to active: