Search code examples
iosxcodeuistoryboardxcode-storyboard

Equal size for buttons in iOS storyboards


I was wondering how can I automatically -if there's a way- set the width of the buttons so they're all the same size, and there's the same margins at both sides of the storyboard. In the screenshot, you guys can see that the buttons are different in size:

enter image description here

There's a space in the middle that I'd like it to be as the space between each button. Is there a way to do this?

Thanks a lot in advance!


Solution

  • No, there's no automatic way to do that. Getting the buttons all the same size is easy -- you can either drag one out, size it how you want, and then duplicate it (command-d) as many times as you want, or you can select them all and resize them in the size inspector. Getting the spacing all the same is more tedious, especially if you want to handle rotations (that's best handled in code using layout constraints).