I want a view to have width 0.4 screen width in landscape and 0.5 screen width in portrait.
So I have tried "vary for traits". I selected wC hR and set 0.5 and clicked "done". Then I selected wR hR and set 0.4 as shown:
Yet both size classes still show as 0.4.
I have also tried setting the constraints using "view as ...(wC hR) etc. without using vary for constraints.
I have also tried adding a separate size class in the box shown, but with no success.
Width size class doesn't always change with the orientation - not on every device.
For example, only on the Plus devices the landscape becomes Regular width, but on other devices it's always compact.
However, the height size class changes on any iPhones (not iPads):
hR
- for portrait and hC
- for landscape.The illustrations on this page should give you more understanding how they work: http://useyourloaf.com/blog/size-classes/
Since there is no option to change the multiplier for different size classes, you need to create two constraints, and set conditions for Installed
.
This one for landscape:
And for portrait: