I have image with some width, that related to superview with some percentage for portrait mode. When device orientation change to landscape mode how to change the percentage in storyboard by changing the multiplier value.
Asked
Active
Viewed 1,450 times
2
-
1`Size classes` is what you need for this. – PGDev Oct 30 '18 at 10:50
-
1Have you tried anything? – Web Artisan Oct 30 '18 at 10:50
-
@ Web Artisan , I tried in Programatically. But i need in storyboard. – Oct 30 '18 at 10:59
-
You cannot directly change the Multiplier, as it is "get only" - but a simple Extension provides a way to do it: https://stackoverflow.com/a/33003217/6257435 – DonMag Oct 30 '18 at 12:20
2 Answers
2
Unfortunately you can't change the multiplier, but you can add two constraints, one with the landscape multiplier and another for the portrait multiplier.
Then in code you can activate/deactivate the constraints when the rotation occurs.
If you get an error in the storyboard just set the priority of one of the constraint to 999 or something under the other.

LorenzOliveto
- 7,796
- 1
- 20
- 47
0
We can't the multiplier
as it is get only property
, but we can adjust width or height constant
to match with multiplier
.

Sateesh Yemireddi
- 4,289
- 1
- 20
- 37