I want to add constraint to the UIImageView
by adding this line of code:
addConstraint(NSLayoutConstraint.constraintsWithVisualFormat("H:|[v0]|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": userProfileImageView]))
But xcode show me this error:
How I can fix this error?
Use addConstraints
, instead of addConstraint
.
constraintsWithVisualFormat
returns an array.
Your code becomes:
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[v0]|", options: [], metrics: nil, views: ["v0": userProfileImageView])