Shaggy D Shaggy D - 1 year ago 115
iOS Question

iOS Autolayout : Place a button exactly in the middle of two other buttons horizontally

I'm trying to build a view which looks something like this : enter image description here

The challenge I'm facing is I'm not able to identify the constraints that will be needed to place Button2 exactly in the center of Button1 and Button3.

All other constraints are satisfied, just struggling with this one. Any help will be appreciated

Answer Source

Embed that buttons in uiview. and set horizontally center in container constraint to it and give top,fixed height and width or leading and trailing constraint to it. And set top,leading,trailing and fixed height to other two buttons.

Or you can give equal width to every buttons, and manage constraints accordingly.

Main concern is take that label in one separate uiview. And then manage constraints accordingly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download