Cartography声明 Swift 中的 Auto Layout
Cartography 是用来声明 Swift 中的 Auto Layout,无需输入任何 stringly 就可设置自己 Auto Layout 的约束声明。
如何使用
layout(view1, view2) { view1, view2 in
view1.width == (view.superview!.width - 50) * 0.5
view2.width == view1.width - 50
view1.height == 40
view2.height == view1.height
view1.centerX == view.superview!.centerX
view2.centerX == view1.centerX
view1.top >= view.superview!.top + 20
view2.top == view1.bottom + 20
}
评论
