confused human
confused human

Reputation: 421

How to position buttons on story board for all devices in xcode

I'm trying to place these buttons that are responsive for all the devices. Can someone please help me? I've been trying this but never worked. attached screen shot for what i'm looking- storyboardThanks in advance

Upvotes: 0

Views: 1072

Answers (1)

vacawama
vacawama

Reputation: 154593

I would try these constraints. You can adjust the constant values to get the look you want:

Top button:

  1. Button.Leading equal to Superview.Leading.
  2. Button.Top equal to Top Layout Guide.Bottom with constant 25.
  3. Superview.Trailing equal to Button.Trailing with constant 70.
  4. Button.Height equal to constant 140.

Middle button:

  1. Button.Leading equal to Superview.Leading with constant 70.
  2. Button.Top equal to FirstButton.Bottom with constant 35.
  3. Superview.Trailing equal to Button.Trailing.

Bottom button:

  1. Button.Leading equal to Superview.Leading.
  2. Button.Top equal to SecondButton.Bottom with constant 35.
  3. Superview.Trailing equal to Button.Trailing with constant 70.
  4. Bottom Layout Guide.Top equal to Button.Bottom with constant 45.
  5. Button.Height equal to constant 140.

This will allow the middle button to grow in height on larger devices, and all buttons will grow in width on larger devices.

Upvotes: 1

Related Questions