3.可用SnapKit代替Masonry
pod 'SnapKit', '~> 0.19.1'
0.20.0以后的会报错,没找到解决方法
import SnapKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let view = UIView.init()
self.view.addSubview(view)
view.backgroundColor = UIColor.redColor()
view.snp_makeConstraints { make in
make.width.height.equalTo(50)
make.center.equalTo(self.view)
}
}
}