SnapKit:
https://github.com/SnapKit/SnapKit
v.snp_makeConstraints{ (make)in
由于swift和oc语法不一样 equalTo(self.view)是传入参数
make.top.equalTo(self.view).offset(100)
make.left.equalTo(self.view).offset(100)
make.right.equalTo(self.view).offset(-100)
make.bottom.equalTo(self.view).offset(-100)
}
Masonry:
https://github.com/SnapKit/Masonry
由于swift和oc语法不一样 equalTo()是先调用get方法
v.mas_makeConstraints{ (make)in
make.top.equalTo()(self.view).setOffset(100)
make.left.equalTo()(self.view).setOffset(100)
make.right.equalTo()(self.view).setOffset(100)
make.bottom.equalTo()(self.view).setOffset(100)
}