bigdaddy
bigdaddy

Reputation: 11

How do you set equal spaces between multiple views and make it vary based on device?

I have multiple views in a view and i need to increase the distance between these views based on the device. Very much like an aspect ratio type thing. How should I go about it using auto layout?

Upvotes: 0

Views: 207

Answers (1)

Unis Barakat
Unis Barakat

Reputation: 886

Since you have more than one view, I recommend doing the following assuming this is the result you are looking for:

final STEP 1 : select all your views

Step 2 : go to Editor -> Embed In -> Stack View (now it will group them together) I'm assuming that you set the width and height constraint for each of your views before doing this.

Step 3 : once you have done that select the stack (not the individual views). but rather the entire stack (I would do this from the side menu) and set the top layout and the bottom layout.

step 4 : Go here and make these settings for the stack as you have it selected

final Step

and that should do it. Let me know if I should clarify anything.

Upvotes: 2

Related Questions