The Wayback Machine - https://web.archive.org/web/20210119143748/https://github.com/freshOS/Stevia/issues/146
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stick two views with space between #146

Open
uloskae opened this issue Jul 1, 2020 · 2 comments
Open

Stick two views with space between #146

uloskae opened this issue Jul 1, 2020 · 2 comments

Comments

@uloskae
Copy link

@uloskae uloskae commented Jul 1, 2020

|-a - 10 - b-|
Above work fine but forces the entire width
How to achieve this?
I was working with

a.Left == a.Right
This way is like SnapKit but is there a way to put padding in the middle ?

@s4cha
Copy link
Member

@s4cha s4cha commented Jul 1, 2020

@sdyalor can you provide a image/ visual representation of want you want please ?

@cowgp
Copy link
Contributor

@cowgp cowgp commented Jul 1, 2020

@sdyalor your example forces the entire width because you are using pipes on both sides which creates a constraint with default margins to the edges. With |-a-10-b-| view a is given a left constraint to it's container's left + default margin. view b is given a left constraint to be view a's right + 10 AND a right constraint to be it's container's right - default margin. If you removed the pipes and just did a-10-b then they will not span the whole width. They would likely be left aligned because autolayout has no other instructions of how to lay them out.
if you wanted them centered with 10 pixels between them it's easier to to use the dot notation and do:

a.Right == parent.Center - 5
b.Left == parent.Center + 5

where parent might be an implied "self" depending on the complexity of your layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.