You can have all constraints for the LabelA.height > 0 case linked to a NSLayoutConstraint IBOutletCollection.
@property (strong, nonatomic) IBOutletCollection(NSLayoutConstraint) *labelAScenarioConstraints;
Same for the LabelA.height = 0 scenario like
@property (strong, nonatomic) IBOutletCollection(NSLayoutConstraint) *labelAWithoutHeightScenarioConstraints
And when you want to change it just do something like:
for (NSLayoutConstraint *constraint in labelAScenarioConstraints) {
[constraint setActive:labelA.frame.size.height > 0];
}
for (NSLayoutConstraint *constraint in labelAWithoutHeightScenarioConstraints) {
[constraint setActive:labelA.frame.size.height == 0];
}
You can activate or deactivate a constraint by changing this property...Activating or deactivating the constraint calls addConstraint: and removeConstraint: on the view that is the closest common ancestor of the items managed by this constraint. Use this property instead of calling addConstraint: or removeConstraint: directly.
Keep in mind that all the UI updates should be done from the main thread. If you want to animate the constraints change you can put the code inside UIView animateWithDuration animations block.