Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to adjust the constraints for portrait and landscape view?

Tags:

ios

autolayout

I have 3 simple buttons, how can I adjust the constraints for portrait and landscape view like below?

Portrait:

enter image description here

Landscape:

enter image description here

like image 263
user3721070 Avatar asked Jan 25 '26 10:01

user3721070


1 Answers

I would put these buttons under a stackview and set constraints as below

enter image description here

The Multipler for both height and width is set to 0.8 i.e. 80% of the dimension. And the distribution of stackview to Fill Equally. This would result in :

Portrait

enter image description here

Landscape

enter image description here

With Align center to X & Y of Superview. They will always be centered.

like image 94
Sahil Avatar answered Jan 27 '26 00:01

Sahil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!