Reputation: 151
I have 3 simple buttons, how can I adjust the constraints for portrait and landscape view like below?
Portrait:
Landscape:
Upvotes: 3
Views: 100
Reputation: 10012
I would put these buttons under a stackview and set constraints as below
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
Landscape
With Align center to X & Y of Superview. They will always be centered.
Upvotes: 1
Reputation: 2186
I would recommend putting the buttons in a view and putting height and width constraints for the button relative to the superview.
You can add constraints to the view where the views leading trailing top and bottom are relative to the superview itself or updating it as the orientation changes.
Upvotes: 0