Twitter login button autolayout

login
xcode
swift

#1

I am trying to align the button above another button.

LogInButton.center = self.view.center
self.view.addSubview(LogInButton)

That is the only thing i can do, so it is in the middle of the screen. But it seems i can’t use something like this

iew.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(“H:|-0-[v0]-0-|”, options: NSLayoutFormatOptions(), metrics: nil, views: [“v0”: loginButton]))

    view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:[v1(40)]-1-[v0]", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0":RegisterEmail,"v1": loginButton]))

The complete app crashes then.

How should i do this?


#2

What’s the crash you’re seeing?