I'm having an UIView with two subviews:
UIActivityIndicatorViewUIlabelThe UIView size is based on the UIActivityIndicatorView and UIlabel with NSLayoutConstraints.
At first the top of the UIView is linked to the top of the UIActivityIndicatorView, when I want to de-activate that constraint and activate the one with the top of the UIView linked to the top of the UIlabel I'm doing this:
_labelLayoutConstraintTopToSuperViewTop.active = YES;
_labelLayoutConstraintTopToActivityIndicatorViewBottom.active = NO;
This will result in an warning, but when I'm switching this to this:
_labelLayoutConstraintTopToActivityIndicatorViewBottom.active = NO;
_labelLayoutConstraintTopToSuperViewTop.active = YES;
I'm no longer getting the warning, until I link the top of the view to the UIActivityIndicatorView again.
Is there any way to put these changes in a batch or something? Am I misunderstanding something? I tried to use setNeedsUpdateConstraints, updateConstraintsIfNeeded, setNeedsLayout and layoutIfNeeded as well, all without success.
I hope I'm clear enough, thnx.
F this, I can't figure it out.
As soon as I activate a constraint I get a warning about a constraint that I probably don't want, and that's correct, because I'm de-activating that constraint on the next line!
My fix for now is to just attach the top of the label to the top of the activity indicator and increase/decrease the constant as needed.
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