Updated
For Specific Ratio : To my understood, We can give Multiplier for Centre Vertically Constraints
. Here ratio of top and bottom space will be same in all iPhone series. I gave Multiplier as 1.4
==================================
I know having several answers there. But, no one used UIStackView
to add two simple buttons.
Drag two UIButton, select that two UIButtons, click Embed in Stack
icon from here.
Stackview Properties
Give following things for UIStackView,
Set Axis
as Horizontal
, Distribution
as Fill Equally
, Spacing
as 10
in Attributes Inspector
Stackview Constraints 1
Give constraints for that UIStackView, Check/Uncheck Margins, Left and Right = 0, Height as 30.
Stackview Constraints 2
Still, some constraints are not satisfied. Press Control
and hold it, Click StackView
and Drag to SuperView
, you will get black pop up. Choose Center Vertically in container
.
Stackview Constraints Customization
If you want to change height of UIButton or Bottom Space, click UIStackView and in Size Inspector
, you can change height or move up/down.
13
solved Auto-layout issue