Skip to content

Extensions to UIView and NSLayoutConstraint to make coding with autolayout less terrible.

Notifications You must be signed in to change notification settings

pcperini-historic/PCAutolayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIView+PCAutolayoutBindingExtensions

Methods

addConstraintBindingToView:onAttribute:

- (void)addConstraintBindingToView:(UIView *)view onAttribute:(NSLayoutAttribute)attribute;

Adds the a constraint to the receiver binding it to the given view on the given attribute.

Parameters

  • view: The view to which to bind the receiver.

  • attribute: The attribute on which to bind the views

Discussion

This method adds the constraint to the super-most view, of the receiver and view. The constraint's relationship is Equal, its multiplier is 1, and its constant is 0.

UIView+PCAutolayoutConstraintExtensions

Properties

heightConstraint

@property (nonatomic, readonly) NSLayoutConstraint *heightConstraint;

The primary constraint responsible for the view's height.

Discussion

The constraint might be applied to the view's superview.

horizontalOriginConstraint

@property (nonatomic, readonly) NSLayoutConstraint *horizontalOriginConstraint;

The primary constraint responsible for the view's horizontal origin.

Discussion

The constraint might be applied to the view's superview.

verticalOriginConstraint

@property (nonatomic, readonly) NSLayoutConstraint *verticalOriginConstraint;

The primary constraint responsible for the view's vertical origin.

Discussion

The constraint might be applied to the view's superview.

widthConstraint

@property (nonatomic, readonly) NSLayoutConstraint *widthConstraint;

The primary constraint responsible for the view's width.

Discussion

The constraint might be applied to the view's superview.

heightConstraint

@property (nonatomic, readonly) NSLayoutConstraint *heightConstraint;

The primary constraint responsible for the view's height.

Discussion

The constraint might be applied to the view's superview.

Methods

addConstraint:withIdentifier:

- (void)addConstraint:(NSLayoutConstraint *)constraint withIdentifier:(NSString *)identifier;

Adds the given constraint to the receiver with the given identifier.

Parameters

  • constraint: The constraint to add.

  • identifier: The identifier for the constraint.

constraintWithIdentifier:

- (NSLayoutConstraint *)constraintWithIdentifier:(NSString *)identifier;  

Returns the constraint with the given identifier.

Parameters

  • identifier: The constraint's identifier.

Returns

The constraint with the given identifier.

NSLayoutConstraint+PCAutolayoutIdentifierExtensions

Properties

identifier

@property (nonatomic) NSString *identifier;

A string identifying the constraint.

User-Defined Attributes

You can use Interface Builder's User-Defined Attributes to set the identifier of a constraint.

About

Extensions to UIView and NSLayoutConstraint to make coding with autolayout less terrible.

Resources

Stars

Watchers

Forks

Packages

No packages published