Class

NSLayoutXAxisAnchor

The NSLayoutXAxisAnchor class is a factory class for creating horizontal 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 NSLayoutXAxisAnchor object.

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

For more information on using layout anchors, see NSLayoutAnchor.

Relationships

Inherits From

See Also

Related Symbols

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.

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:

Related Documentation