Tag Archives: NSLayoutConstraint

Autolayout: change constraint multiplier

the NSLayoutConstraint multiplier property is read-only. But if you need to change it, you can replace the constraint with a modified clone like @implementation NSLayoutConstraint(ChangeMultiplier) // visal form center http://stackoverflow.com/a/13148012/349514 -(NSLayoutConstraint *)constraintWithMultiplier:(CGFloat)multiplier { return [NSLayoutConstraint constraintWithItem:self.firstItem attribute:self.firstAttribute relatedBy:self.relation toItem:self.secondItem attribute:self.secondAttribute multiplier:multiplier constant:self.constant]; } @end@implementation NSLayoutConstraint(ChangeMultiplier) // visal form center http://stackoverflow.com/a/13148012/349514 -(NSLayoutConstraint *)constraintWithMultiplier:(CGFloat)multiplier { return [NSLayoutConstraint […]