I'm trying to add constraint to navigation bar, I have UIImageView
, which has width, height and is centered horizontally, I want to add vertical space between UIImage
and navigationBar
to 0, I'm trying this for like 1 hour and couldn't figure out how, i tried adding constraint to UIView
, and added constant of navbarHeight + statusBarHeight
, and it worked, but I want to make relationship between imageview and navbar
let verticalSpace = NSLayoutConstraint(item: image, attribute: .Top, relatedBy: .Equal, toItem: self.view, attribute: .Top, multiplier: 1, constant: 0)
view.addConstraint(verticalSpace) // this works