Class

NSLayoutYAxisAnchor

The NSLayoutYAxisAnchor class is a factory class for creating vertical NSLayoutConstraint objects using a fluent interface (an interface designed to produce more readable code). Use these constraints to programatically define your layout using Auto Layout.

Overview

Although this class does not provide any additional methods, it does add type information to the methods inherited from NSLayoutAnchor. Specifically, the generic methods declared by NSLayoutAnchor must now take a matching NSLayoutYAxisAnchor object.

// This constraint is valid
cancelButton.topAnchor.constraintEqualToAnchor(saveButton.topAnchor, constant: 8.0).active = true
 
// This constraint generates an incompatible pointer type warning
cancelButton.topAnchor.constraintEqualToAnchor(saveButton.trailingAnchor, constant: 8.0).active = true

For more information on using layout anchors, see NSLayoutAnchor.

Relationships

Inherits From

See Also

Related Symbols

NSLayoutConstraint

A constraint defines a relationship between two user interface objects that must be satisfied by the constraint-based layout system. Each constraint is a linear equation with the following format:

NSLayoutAnchor

The NSLayoutAnchor class is a factory class for creating NSLayoutConstraint objects using a fluent API. Use these constraints to programatically define your layout using Auto Layout.

Related Documentation