I have a view which contains a few constraints. Some of them have the Installed checkbox turned off. I am trying to activate and deactivate specific constraints depending on the state of my application.
The problem is that when the installed checkbox is turned off I can't activate the constraints and also I can't deactivate the installed constraints.
I need to mention that I use strong references for the constraints in my size classes properties. I also tried an approach to call setNeedsUpdateConstraints
and updateConstraintsIfNeeded, setNeedsLayout
and layoutIfNeeded
, after activating/deactivating the constraints.
I couldn't find any documentation regarding this behavior so why is this happening?
Be sure that you put your code in the right place
override func viewDidLayoutSubviews() {
// write your code here
}