RTzhong
RTzhong

Reputation: 205

use topLayoutGuide programmatically in swift2.1

I am using Swift2.1 and I want to add a subview to my view of the view controller, which has a navigationBar on top of the screen. So I tried to set constraints that subview.top equals self.topLayoutGuide.Bottom, my code is as the following:

enter image description here

As I run the app, it crashed with error:

enter image description here

Am I wrong editing the string of "V: [selfTopLayoutGuide]-[subview]-[selfBottomLayoutGuide]"? Or is there any way to solve this problem?

Upvotes: 0

Views: 95

Answers (1)

James P
James P

Reputation: 4836

The error is pointing to the space in your string, remove it.

"V:[selfTopLayoutGuide]-[subview]-[selfBottomLayoutGuide]"

Upvotes: 2

Related Questions