Update docs.md (#437)

Snap view to topLayoutGuide and bottomLayoutGuide
This commit is contained in:
Anmol Malhotra 2017-08-08 12:32:46 +05:30 committed by Robert Payne
parent ecabedd462
commit 3b2ee222d7
1 changed files with 26 additions and 0 deletions

26
docs.md
View File

@ -301,3 +301,29 @@ func changeButtonPosition() {
}
}
```
### Snap view to topLayoutGuide and bottomLayoutGuide
`topLayoutGuide.snp.bottom` is similar to `topLayoutGuide.bottomAnchor` and you can also use `bottomLayoutGuide.snp.top` to align view on top of UITabBar.
```swift
import SnapKit
class MyViewController: UIVewController {
lazy var tableView = UITableView()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(tableView)
tableView.snp.makeConstraints { (make) -> Void in
make.top.equalTo(topLayoutGuide.snp.bottom)
make.left.equalTo(view)
make.right.equalTo(view)
make.bottom.equalTo(bottomLayoutGuide.snp.top)
}
}
}
```