NSLayoutConstraint学习记录
2016-12-15 本文已影响0人
牛牛的王大虾
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];