YetLayout
iOS 自动布局通过 swift
let lb = UILabel(frame:CGRect.zero)
self.view.addSubView(lb)
基本用法,属性开头
lb.layout.width.eq(300).active()
lb.layout.width.eq(300).priority(800).ident("mylabel").active()
lb.layout.width.eq(imageView).width.multi(2).offset(8).priority(800).ident("mylabel2").active()
属性相同时,后面的属性可以省略
lb.layout.width.eq(imageView).active()
lb.layout.left.eq(imageView).right.active()
lb.layout.left.eqParent.active()
组合用法, 函数开头
lb.layout.centerParent().width(200).height(200)
lb.layout.fillX().topParent(16).height(200)
lb.layout.toRightOf(imageView).width(200).topParent(30).height(150)
删除和更新, 更新只能更新constant属性
lb.layout.removeAll()
lb.layout.remove(ident: "mylabel")
lb.layout.width.eq(200).update()
lb.layout.width.eq(200).remove()
示例
要运行示例项目,请克隆仓库,然后从示例文件夹中运行 pod install
。
要求
安装
YetLayout 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
pod 'YetLayout'
作者
yangentao, [email protected]
授权
YetLayout 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。