XIB
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *bgViewRightConstraint;定义一个出来,然后self.bgViewRightConstraint.constant = -35;这样使用修改就好
代码
self.bgViewRightConstraint = [NSLayoutConstraint constraintWithItem:self.bgView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:15];
[self addConstraint:self.bgViewRightConstraint];
网友评论