Skip to content

Commit

Permalink
Add API to pin edges to superview edges
Browse files Browse the repository at this point in the history
- Expose a variant of `-autoPinEdgesToSuperviewEdgesWithInsets:` that
omits the insets parameter, defaulting to zero insets.

Fixes #76
  • Loading branch information
smileyborg committed Jul 28, 2015
1 parent e2e75ab commit c97a577
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions PureLayout/PureLayout/ALView+PureLayout.h
Expand Up @@ -104,6 +104,9 @@
/** Pins the given edge of the view to the same edge of its superview with an inset as a maximum or minimum. */
- (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset relation:(NSLayoutRelation)relation;

/** Pins the edges of the view to the edges of its superview. */
- (NSArray *)autoPinEdgesToSuperviewEdges;

/** Pins the edges of the view to the edges of its superview with the given edge insets. */
- (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets;

Expand Down
10 changes: 10 additions & 0 deletions PureLayout/PureLayout/ALView+PureLayout.m
Expand Up @@ -376,6 +376,16 @@ - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFlo
return [self autoPinEdge:edge toEdge:edge ofView:superview withOffset:inset relation:relation];
}

/**
Pins the edges of the view to the edges of its superview.
@return An array of constraints added.
*/
- (NSArray *)autoPinEdgesToSuperviewEdges
{
return [self autoPinEdgesToSuperviewEdgesWithInsets:ALEdgeInsetsZero];
}

/**
Pins the edges of the view to the edges of its superview with the given edge insets.
The insets.left corresponds to a leading edge constraint, and insets.right corresponds to a trailing edge constraint.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -37,7 +37,7 @@ Additionally, there is one generic attribute type, `ALAttribute`, which is effec
- autoCenterInSuperviewMargins: // iOS 8.0+ only
- autoAlignAxisToSuperviewMarginAxis: // iOS 8.0+ only
- autoPinEdgeToSuperviewEdge:(withInset:)
- autoPinEdgesToSuperviewEdgesWithInsets:(excludingEdge:)
- autoPinEdgesToSuperviewEdges(WithInsets:)(excludingEdge:)
- autoPinEdgeToSuperviewMargin: // iOS 8.0+ only
- autoPinEdgesToSuperviewMargins(ExcludingEdge:) // iOS 8.0+ only
- autoPinEdge:toEdge:ofView:(withOffset:)
Expand Down

0 comments on commit c97a577

Please sign in to comment.