Skip to content

Layout - constraint to another view #1139

@davidevincenzi

Description

@davidevincenzi

Hello,

it's a pretty basic question but I can't find an answer.
I have two labels, both children of the same view.

I set up the first label like this:
view.layout(firstLabel).top(100).right(10).left(10)

How do I set up the secondLabel so that it's 30 pixels below the bottom edge of the firstLabel?

Using standard autolayout syntax I would write it like this:

self.view.addConstraint(
    NSLayoutConstraint(
        item: secondLabel,
        attribute: .Top,
        relatedBy: .Equal,
        toItem: firstLabel,
        attribute: .Bottom,
        multiplier: 1.0,
        constant: 0
    ))

Is there a way to do that by using Material?

Thanks!

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions