iOS 自动布局库 SDAutoLayout

码农软件 · 软件分类 · 视图布局(View Layout) · 2019-06-22 16:13:28

软件介绍

SDAutoLayout(一行代码搞定自动布局!) 

github地址 https://github.com/gsdios/SDAutoLayout

SDAutoLayout使用者开发的部分app截图 http://www.jianshu.com/p/9bc04d3effb8

QQ交流群:497140713  519489682(新开)

☆☆ SDAutoLayout 基础版视频教程:http://www.letv.com/ptv/vplay/24038772.html ☆☆

☆☆ SDAutoLayout 进阶版视频教程:http://www.letv.com/ptv/vplay/24381390.html ☆☆

☆☆ SDAutoLayout 原理简介视频教程:http://www.iqiyi.com/w_19rt0tec4p.html ☆☆


一行代码搞定自动布局!

摒弃复杂累赘的约束,利用运行时Runtime在合适的时机布局视图。

SDAutoLayout 部分demo展示


 

0.用法示例

/* 用法一 */
_view.sd_layout
.leftSpaceToView(self.view, 10)
.topSpaceToView(self.view, 80)
.heightIs(130)
.widthRatioToView(self.view, 0.4);  

/* 用法二 (一行代码搞定,其实用法一也是一行代码) */
_view.sd_layout.leftSpaceToView(self.view, 10).topSpaceToView(self.view,80).heightIs(130).widthRatioToView(self.view, 0.4);

1.用法简析

1.1 > leftSpaceToView(self.view, 10)

方法名中带有“SpaceToView”的方法表示到某个参照view的间距,需要传递2个参数:(UIView)参照view 和 (CGFloat)间距数值

1.2 > widthRatioToView(self.view, 1)

方法名中带有“RatioToView”的方法表示view的宽度或者高度等属性相对于参照view的对应属性值的比例,需要传递2个参数:(UIView)参照view 和 (CGFloat)倍数

1.3 > topEqualToView(view)

方法名中带有“EqualToView”的方法表示view的某一属性等于参照view的对应的属性值,需要传递1个参数:(UIView)参照view

1.4 > widthIs(100)

方法名中带有“Is”的方法表示view的某一属性值等于参数数值,需要传递1个参数:(CGFloat)数值

PS

/* 如果您需要布局错误LOG信息提示请打开此宏 */

//#define SDAutoLayoutIssueLog


本文地址:https://codercto.com/soft/d/8541.html

Computational Geometry

Computational Geometry

Mark de Berg、Otfried Cheong、Marc van Kreveld、Mark Overmars / Springer / 2008-4-16 / USD 49.95

This well-accepted introduction to computational geometry is a textbook for high-level undergraduate and low-level graduate courses. The focus is on algorithms and hence the book is well suited for st......一起来看看 《Computational Geometry》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具