轻量级自动布局框架PureLayout

1.设置高度宽度
[view1 autoSetDimension:ALDimensionHeight toSize:70.0];
[view1 autoSetDimension:ALDimensionWidth toSize:70.0];

2.相对于父视图
ALEdgeInsets defInsets = ALEdgeInsetsMake(20.0,20.0,20.0,20.0);
[view1 autoPinEdgesToSuperviewEdgesWithInsets:defInsets];
相当于下面的写法
[view1 autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:20.0];
[view1 autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:20.0];
[view1 autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:20.0];
[view1 autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:20.0];

相对于父视图除了某一个
[view1 autoPinEdgesToSuperviewEdgesWithInsets:defInsets excludingEdge:ALEdgeBottom];

3.两个视图的相对位置
[view2 autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:view1 withOffset:defInsets.bottom];

4.同宽同高
[@[view1,view2]autoMatchViewsDimension:ALDimensionHeight];可以设置多种
[view1 autoMatchDimension:ALDimensionHeight toDimension:ALDimensionHeight ofView:view2];

5.水平对齐垂直对齐
[view1 autoAlignAxis:ALAxisHorizontal toSameAxisOfView:view2];
[view1 autoAlignAxis:ALAxisVertical toSameAxisOfView:view2];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容