I am trying to set up the width of a
UIButton using this code:
constraintButtonPlayWidth = NSLayoutConstraint (item: buttonPlay, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Width, multiplier: 1, constant: 100) self.view.addConstraint(constraintButtonPlayWidth)
But the button gets stretched too much; probably because
toItem: self.view. I tried modifying the the constant of the constraint, but that didn't change anything.
How do I set up correctly this constraint so it actually have a width of 100?