Class

NSLayoutDimension

A factory class for creating size-based layout constraint objects using a fluent API.

Declaration

@interface NSLayoutDimension : NSLayoutAnchor

Overview

Use these constraints to programatically define your layout using Auto Layout. All sizes are measured in points. In addition to providing size-specific methods for creating constraints, this class adds type information to the methods inherited from NSLayoutAnchor. Specifically, the generic methods declared by NSLayoutAnchor must now take a matching NSLayoutDimension object.

// This works as expected.
[self.saveButton.widthAnchor constraintEqualToAnchor:self.cancelButton.widthAnchor].active = YES;
 
// This generates an incompatible pointer type warning.
[self.saveButton.widthAnchor constraintEqualToAnchor:self.cancelButton.leadingAnchor].active = YES;

For more information on using layout anchors, see NSLayoutAnchor.

Topics

Building Constraints

- constraintEqualToAnchor:multiplier:

Returns a constraint that defines the anchor’s size attribute as equal to the specified anchor multiplied by the constant.

- constraintEqualToAnchor:multiplier:constant:

Returns a constraint that defines the anchor’s size attribute as equal to the specified size attribute multiplied by a constant plus an offset.

- constraintEqualToConstant:

Returns a constraint that defines a constant size for the anchor’s size attribute.

- constraintGreaterThanOrEqualToAnchor:multiplier:

Returns a constraint that defines the anchor’s size attribute as greater than or equal to the specified anchor multiplied by the constant.

- constraintGreaterThanOrEqualToAnchor:multiplier:constant:

Returns a constraint that defines the anchor’s size attribute as greater than or equal to the specified anchor multiplied by the constant plus an offset.

- constraintGreaterThanOrEqualToConstant:

Returns a constraint that defines the minimum size for the anchor’s size attribute.

- constraintLessThanOrEqualToAnchor:multiplier:

Returns a constraint that defines the anchor’s size attribute as less than or equal to the specified anchor multiplied by the constant.

- constraintLessThanOrEqualToAnchor:multiplier:constant:

Returns a constraint that defines the anchor’s size attribute as greater than or equal to the specified anchor multiplied by the constant plus an offset.

- constraintLessThanOrEqualToConstant:

Returns a constraint that defines the maximum size for the anchor’s size attribute.

Relationships

Inherits From

See Also

Layout Guides

UILayoutGuide

A rectangular area that can interact with Auto Layout.