Skip to content

glucose is a set of syntactic sugar methods for AutoLayout.

License

Notifications You must be signed in to change notification settings

idomizrachi/glucose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glucose

Overview

glucose is a set of syntactic sugar methods for AutoLayout.

The following code sample:

[self.view addSubview: self.backgroundView];
[self.view addSubview: self.titleLabel];
[self.view addSubview: self.footerLabel];
[self.view addSubview: self.leftLabel];
[self.view addSubview: self.rightLabel];
[self.view addSubview: self.squareView];
[self.view addSubview: self.squareView2];
[self.view addSubview: self.squareView3];

[self.backgroundView edgesToView:self.view];

[self.titleLabel centerXInView: self.view];
[self.titleLabel topToTopOfView:self.view offset:20.0f];

[self.footerLabel bottomToBottomOfView:self.view offset:20.0f];
[self.footerLabel widthEqualToView:self.view];
[self.footerLabel heightWithMin:44.0f];

[self.leftLabel topToBottomOfView:self.titleLabel offset:20.0f];
[self.rightLabel topToBottomOfView:self.titleLabel offset:20.0f];
[self.leftLabel widthEqualToView:self.rightLabel];

[self.leftLabel leadingToLeadingOfView:self.view offset:20.0f];
[self.rightLabel trailingToTrailingOfView:self.view offset:20.0f];
[self.rightLabel leadingToTrailingOfView:self.leftLabel offset:20.0f];

[self.squareView size:CGSizeMake(45.0f, 45.0f)];
[self.squareView topToBottomOfView:self.leftLabel offset:20.0f];
[self.squareView centerInView:self.view];

[self.squareView2 width: 30.0f];
[self.squareView2 height:30.0f];
[self.squareView2 leadingToLeadingOfView:self.view offset:20.0f];
[self.squareView2 bottomToTopOfView:self.footerLabel offset:30.0f];

[self.squareView3 leadingToLeadingOfView:self.view offset:20.0f];
[self.squareView3 topToBottomOfView:self.squareView offset:15.0f];
[self.squareView3 trailingToLeadingOfView:self.rightLabel offset:0.0f];
[self.squareView3 height: 45.0f];  

Generates this UI:

alt text

See the Example project for the complete implementation.

Installation

CocoaPods

Glucose is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "glucose"

Thanks

Glucose is inspired by TinyConstraints.

About

glucose is a set of syntactic sugar methods for AutoLayout.

Resources

License

Stars

Watchers

Forks

Packages

No packages published