Fattie
Fattie

Reputation: 12647

Autolayout "Update Constraints" button, but, calculate proportion, not constant?

Short version:

The function of the 'Update Constraints' button is that it calculates/updates the numerical values of an existing constraint for you (based on visual changes in the storyboard). However, it seems to only calculate/update the 'Constant' value. This is not useful in the case of proportional-mode constraints. How to use 'Update Constraints' button to modify the 'Multiplier' numerical value rather than 'Constant' numerical value?


Example, all constraints are correctly in place. You wish to change the height of an item. Do so visually by dragging...

enter image description here

use 'Update Constraints'...

enter image description here

it calculates/updates the new value of "Constant" for you...

enter image description here

(Note that the opposite function, "Update Frames" is also critical; it moves the visual side to where you have changed the text entry values.)

That's fantastic. But.

But what if, in fact, the constraint is proportional mode?

so, you want the Constant value to remain at zero, and you want it to recalculate the Multiplier for you.

(Looking at the example above, it should be changing the multiplier from .075 to say .08123.)

Is there a way to do this?

How to make "Update Constraints" button affect the "Multiplier", rather than the "Constant"? Is it a key modifier, or??

Upvotes: 1

Views: 186

Answers (1)

BangOperator
BangOperator

Reputation: 4437

Thanks for elaborating your question.

The answer is NO. "Update constraints" button always modifies the constant values of the constraints. This is supported by the fact NSLayoutConstaint's constant property is read write but multiplier is readonly.

Upvotes: 1

Related Questions