iosautolayoutconstraintsadaptive-layout

Changing constraint multiplier using traits


I have several objects with a width of at least 75% of the screen width. The issue is that they do not look as good on iPads or landscape mode. I want to change the "75%" for different traits but couldn't figure out how.

I've looked at the details of the constraint and clicked on the PLUS icon: enter image description here

After adding a variation, I see that I can change the constant but not the multiplier: enter image description here

Anyone has any idea how this can be done elegantly?

Thanks


Solution

  • Have two different constraint one for regular width (iPad) and one for compact width (iPhone). Then add a variation to install the constraint only for the trait you are interested in by checking / unchecking the Installed option.