AutoLayout-SnapKit
示例
要运行示例项目,请克隆仓库,然后首先在 Example 目录中运行 pod install
import AutoLayout_SnapKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let temp = UIView()
temp.backgroundColor = .cyan
temp.layer.cornerRadius = 30
// view.addSubview(v)
view.layoutSv(temp).marginsSafe()
let lab = UILabel()
lab.backgroundColor = .white
lab.numberOfLines = 0
lab.text = "测试label, Do any additional setup after loading the view, typically from a nib."
temp.layoutSv(lab)
// 高度动态变化,最大 50
.height(.max(50))
// 垂直居中
.centerY()
// 水平间距 10
.horz()
}
}
需求
iOS 10.0, macOS 10.12, tvOS 10.0
Swift 5.0
安装
AutoLayout-SnapKit 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile:
pod 'AutoLayout-SnapKit', '~> 1.0.0'
作者
jianli, [email protected]
许可
AutoLayout-SnapKit 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。