There is a TextView that has NSLayoutConstraint (textViewHeight) , the multiplier value is 0.3 , when you click on this TextView , the multiplier value should increase to 0.6 .

I'm trying to write _textViewHeight.multiplier = 0.6 , but Xcode swears that the mutiplier field is readonly and cannot be changed.

On the forums it is advised to create a second Constraint with a different value and switch between two Constraint with different values. But how to do that?

    1 answer 1

    Yes, multiplier is a read only property , and it cannot be changed, and for you, really, the solution to use one more constraints appropriate. Here's an example of how you can do this:

     NSLayoutConstraint *standardConstraint, *zoomedConstraint; // ... // switch between constraints standardConstraint.active = NO; zoomedConstraint.active = YES; [self.view layoutIfNeeded]; // or using 

    But you can set constraint like this:

     [self.view addConstraints:standardConstraint options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(_textView)]];