NSLayoutConstraint Multiplier Extension
extension NSLayoutConstraint { | |
func setMultiplier(multiplier:CGFloat) -> NSLayoutConstraint { | |
let newConstraint = NSLayoutConstraint( | |
item: firstItem, | |
attribute: firstAttribute, | |
relatedBy: relation, | |
toItem: secondItem, | |
attribute: secondAttribute, | |
multiplier: multiplier, | |
constant: constant) | |
newConstraint.priority = priority | |
newConstraint.shouldBeArchived = self.shouldBeArchived | |
newConstraint.identifier = self.identifier | |
newConstraint.active = true | |
NSLayoutConstraint.deactivateConstraints([self]) | |
NSLayoutConstraint.activateConstraints([newConstraint]) | |
return newConstraint | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment