How to Align four buttons at dead center in Xcode 7?

Begginer

How do I align these four buttons to be at the center (horizontally and vertically) for the diff sizes of screens. I see different sizes and positions of the buttons when I run the project in the different size of the simulator. Is there a way to make the four buttons to be at center (and same size) for ALL devices?

I don't have any experience with constrains, it has been a while since I used Xcode. I read tutorials about constrains for hours, but I still don't understand how to use it.

Screenshot

Thank you and happy holidays :)

user4151918

The easiest way to accomplish this is to use a UIStackView. Very simple to use, and it automatically manages the layout for the buttons.

Remove the existing constraints for your buttons, then select all four and choose Editor -> Embed in -> Stack View.

Add two constraints to center your stack view in the view, and you're done!

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related