Is is possible to position an element offscreen using Visual Format Language?

93 Views Asked by At

I get an error when I try this:

let space = UILayoutGuide()
view.addLayoutGuide(space)

let myFormatString = "someLabel|space-anotherLabel-|"

Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Unable to parse constraint format:  Expected a view
someLabel|space-anotherLabel  
^'

I also tried this:

let myFormatString = "|-someLabel-space(==viewWidth)-anotherLabel"

...
...
                metrics: [
                    "viewWidth": view.frame.width
                ],

But that produced the error:

Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Unable to parse constraint format: 
It's not possible to set a space equal to the width or height of a view.
Perhaps you want to use a view as a spacer? 
[view1][spacer(==view1)][view2] 
|-someLabel-space(==viewWidth)-anotherLabel 
0

There are 0 best solutions below