This commit is contained in:
Spiros Gerokostas 2016-03-01 13:16:44 +02:00
parent a231343050
commit 98298bb1ab
1 changed files with 12 additions and 0 deletions

View File

@ -18,12 +18,19 @@ class SimpleLayoutViewController: UIViewController {
return view return view
}() }()
let redView: UIView = {
let view = UIView()
view.backgroundColor = .redColor()
return view
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = UIColor.whiteColor() view.backgroundColor = UIColor.whiteColor()
view.addSubview(blackView) view.addSubview(blackView)
view.addSubview(redView)
view.setNeedsUpdateConstraints() view.setNeedsUpdateConstraints()
} }
@ -37,6 +44,11 @@ class SimpleLayoutViewController: UIViewController {
make.size.equalTo(CGSizeMake(100.0, 100.0)) make.size.equalTo(CGSizeMake(100.0, 100.0))
}) })
redView.snp_makeConstraints(closure: { (make) -> Void in
make.top.equalTo(blackView.snp_bottom).offset(20.0)
make.size.equalTo(CGSizeMake(100.0, 100.0))
})
didSetupConstraints = true didSetupConstraints = true
} }