Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

致力于做最简单易用的Autolayout库。The most easy way for autolayout.

Notifications You must be signed in to change notification settings

TodayHu/SDAutoLayout

Repository files navigation

SDAutoLayout

致力于做最简单易用的Autolayout库。The most easy way for autolayout.

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

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

About

致力于做最简单易用的Autolayout库。The most easy way for autolayout.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%

AltStyle によって変換されたページ (->オリジナル) /