测试测试过 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
版本最后发布 | 2017年10月 |
SwiftSwift 版本 | 3.0 |
支持支持 SPM | ✗ |
由 EasyMakePhotoPicker 维护。
FluidAnchor 是一个框架,使使用 Auto Layout Anchor 变得更容易。
pod 'FluidAnchor'
import FluidAnchor
class ViewController: UIViewController {
var tableView = UITableView()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(tableView)
tableView.flu
.topAnchor(equalTo: view.safeAreaLayoutGuide.topAnchor)
.leftAnchor(equalTo: view.safeAreaLayoutGuide.leftAnchor)
.rightAnchor(equalTo: view.safeAreaLayoutGuide.rightAnchor)
.bottomAnchor(equalTo: view.safeAreaLayoutGuide.bottomAnchor)
}
}
import FluidAnchor
class ProfileViewController: UIViewController {
var profileImageView = UIImageView()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(profileImageView)
profileImageView.flu
.topAnchor(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 5)
.leftAnchor(equalTo: view.leftAnchor, constant: 10)
.heightAnchor(equalToConstant: 50)
.widthAnchor(equalToConstant: 50)
}
}
import FluidAnchor
class ChatVC: UIViewController {
var inputBar = InputBar()
var inputBarBottomConstraint: NSLayoutConstraint?
override func viewDidLoad() {
...
// You can specify the constraint to use later when animating.
inputBar.flu
.bottomAnchor(
equalTo: view.safeAreaLayoutGuide.bottomAnchor,
constraint: &inputBarBottomConstraint
)
...
}
...
func keyboardWillShow(_ notification: Notification) {
...
inputBarBottomConstraint?.constant = (someting value)
UIView.animate(withDuration: keyboardDuration) {
view.layoutIfNeeded()
}
...
}
...
}
FluidAnchor 在 MIT 许可下可用。请参阅 LICENSE 文件以获取更多信息。