类
1.1 NSLayoutConstraint(使用代码进行约束)

1.1.1使用代码实例
let leftCons = NSLayoutConstraint(item: 相片, attribute: .Leading, relatedBy: .Equal, toItem: 相片.superview, attribute: .Leading, multiplier: 1, constant: 0)
let rightCons = NSLayoutConstraint(item: 相片, attribute:.Trailing , relatedBy: .Equal, toItem: 相片.superview, attribute: .Trailing, multiplier: 1, constant: 0)
let topCons = NSLayoutConstraint(item: 相片, attribute:.Top, relatedBy: .Equal, toItem: 相片.superview, attribute: .Top, multiplier: 1, constant: 0)
let bottomCons = NSLayoutConstraint(item: 相片, attribute:.Bottom , relatedBy: .Equal, toItem: 相片.superview, attribute: .Bottom, multiplier: 1, constant: 0)
leftCons.active = true
rightCons.active = true
topCons.active = true
bottomCons.active = true
浙公网安备 33010602011771号