SDAutoLayout-Auto layout tool for iOS development

SDAutoLayout-Auto layout tool for iOS development

SDAutoLayout

Committed to making the most simple and easy-to-use Autolayout library. The most easy way for autolayout.

Abandon complex and cumbersome constraints, and use Runtime to lay out the view at the right time.

0. Usage example

/*   */
_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. Brief analysis of usage

1.1> leftSpaceToView(self.view, 10)

The method with "SpaceToView" in the method name indicates the distance to a reference view, and two parameters need to be passed: (UIView) reference view and (CGFloat) distance value

1.2> widthRatioToView(self.view, 1)

The method with "RatioToView" in the method name indicates the ratio of the width or height of the view to the corresponding attribute value of the reference view. Two parameters need to be passed: (UIView) reference view and (CGFloat) multiples

1.3> topEqualToView(view)

The method with "EqualToView" in the method name indicates that a certain attribute of the view is equal to the corresponding attribute value of the reference view, and 1 parameter needs to be passed: (UIView) reference view

1.4> widthIs(100)

The method with "Is" in the method name indicates that a certain attribute value of the view is equal to the parameter value, and 1 parameter needs to be passed: (CGFloat) value

PS

/* If you need layout error LOG information prompt, please open this macro*/

//#define SDAutoLayoutIssueLog