Skip to content
This repository was archived by the owner on May 18, 2021. It is now read-only.

Commit e3ea54a

Browse files
committed
update snapkit demo
1 parent b014230 commit e3ea54a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Snapkit Demo/Demo/ViewController.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ class ViewController: UIViewController {
3636
blueView.addConstraint(widthConstraint)
3737
let heightConstraint = NSLayoutConstraint(item: blueView, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 100)
3838
blueView.addConstraint(heightConstraint)
39-
39+
4040
// iOS 8
41-
NSLayoutConstraint(item: blueView, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0).isActive = true
41+
let centerXConstraint = NSLayoutConstraint(item: blueView, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0)
42+
centerXConstraint.isActive = true
4243
NSLayoutConstraint(item: blueView, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: 0).isActive = true
4344
}
4445

@@ -53,8 +54,7 @@ class ViewController: UIViewController {
5354
func snapkitWay() {
5455
blueView.snp.makeConstraints { (make) in
5556
make.width.height.equalTo(100)
56-
make.center.equalTo(self.view.center)
57-
//equalToSuperview()
57+
make.center.equalToSuperview()
5858
//make.width.equalTo(view).multipliedBy(2).offset(1).priority(800).labeled("BlueViewWidth")
5959
}
6060
}

0 commit comments

Comments
 (0)