layoutpod 0.1.2

layoutpod 0.1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布时间上次发布2016年11月
SwiftSwift 版本3.0
SPM支持 SPM

Rob Broadwell LTD 维护。



layoutpod 0.1.2

  • Rob Broadwell

layoutpod

示例

要运行示例项目,首先将其克隆到本地,然后在 Example 目录下运行 pod install

要求

安装

layoutpod 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile

pod "layoutpod"

用法

该库是 UIView 的扩展,并添加了以下方法

view.constrainLeftRight(subview)
view.constrainTopBottom(subview)
view.constrainAllSides(subview)
view.constrainCenter(subview)

要将 Subview 填充到 Superview 中,只需一行代码即可,而不是四行

view.constrainAllSides(subview)

… instead of four

view.addConstraint(subview.leftAnchor.constraint(equalTo: view.leftAnchor))
view.addConstraint(subview.rightAnchor.constraint(equalTo: view.rightAnchor))
view.addConstraint(subview.topAnchor.constraint(equalTo: view.topAnchor))
view.addConstraint(subview.bottomAnchor.constraint(equalTo: view.bottomAnchor))

您还可以向约束方法传递一个 'padding' 常数

view.constrainLeftRight(subview, 20.0)
view.constrainTopBottom(subview, 20.0)
view.constrainAllSides(subview, 20.0)

作者

Rob Broadwell,[email protected]

许可证

layoutpod 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。