Using auto layout I am trying to create two buttons on the bottom like this
After dragging two buttons I set constraints like this
On Back button
I set Leading Space to Container Margin
and Bottom Space to Bottom Layout Guide
On Go To Settings button
I set Trailing Space to Container Margin
and Bottom Space to Bottom Layout Guide
Then I ctrl+Drag
from Back button
to Go To Settings button
and set the Equal Widths
constraint and I get this.
Then I update the Back button
width same as Go To Settings button
which is 101
and all constraints turn to blue.
But I want both buttons to cover half of the screen no matter what the size of screen is, same as shown in first screen shot, How to accomplish this?
you can done it using equal width to 2nd button like this
and the output is
Here is apple guide
You can have the equal widths constraint between the buttons, but you also have to tell them which is that width you need.
So drag from a button to the superview, add an equal widths constraint. Then in the properties of the constraint you've added, set the multiplier
to 0.5
, this way your buttons should be on half the screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With