Karim
Karim

Reputation: 434

How do I use storyboard aspect ratio to set buttons with equal with automatically?

Basically how do I use the aspect ratio constrain properly to set all buttons equally spaced with same width and height. I got the heights but then the four buttons using the aspect ratio constraint is confusing me a little bit. I can't seem to figure out the multiplier. There is no code for this, it is all using storyboards.

enter image description here

enter image description here

enter image description here

Upvotes: 0

Views: 3311

Answers (1)

themobileapper
themobileapper

Reputation: 184

Looks like you want to have buttons with equal widths.

  1. Select all the buttons and apply the following constraints. Make sure that the buttons do not overlap or else the leading and trailing constraints will be set with the wrong button. enter image description here

  2. Once that is done, select all the buttons and update their frames

That should do the trick.

Also, make sure the view that is holding the buttons has its constraints set.

Upvotes: 1

Related Questions