<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSLayoutYAxisAnchor",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutYAxisAnchor"
  },
  "title" : "NSLayoutYAxisAnchor"
}
-->

# NSLayoutYAxisAnchor

A factory class for creating vertical layout constraint objects using a fluent API.

```
@MainActor class NSLayoutYAxisAnchor
```

## Overview

[`NSLayoutYAxisAnchor`](/documentation/UIKit/NSLayoutYAxisAnchor) adds type information to the methods inherited from [`NSLayoutAnchor`](/documentation/UIKit/NSLayoutAnchor). Specifically, the generic methods declared by [`NSLayoutAnchor`](/documentation/UIKit/NSLayoutAnchor) must now take a matching [`NSLayoutYAxisAnchor`](/documentation/UIKit/NSLayoutYAxisAnchor) object.

```objc
// This constraint is valid
[self.cancelButton.leadingAnchor constraintEqualToAnchor:self.saveButton.trailingAnchor constant: 8.0].active = true;
 
// This constraint generates an incompatible pointer type warning
[self.cancelButton.topAnchor constraintEqualToAnchor:self.saveButton.trailingAnchor constant: 8.0].active = true;
```

For more information on using layout anchors, see [`NSLayoutAnchor`](/documentation/UIKit/NSLayoutAnchor).

## Topics

### Building system spacing constraints

[`-  constraintEqualToSystemSpacingBelowAnchor:multiplier:`](/documentation/UIKit/NSLayoutYAxisAnchor/constraint(equalToSystemSpacingBelow:multiplier:))

Returns a constraint that defines the specific distance at which the current anchor is positioned below the specified anchor.

[`-  constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:`](/documentation/UIKit/NSLayoutYAxisAnchor/constraint(greaterThanOrEqualToSystemSpacingBelow:multiplier:))

Returns a constraint that defines the minimum distance by which the current anchor is positioned below the specified anchor.

[`-  constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:`](/documentation/UIKit/NSLayoutYAxisAnchor/constraint(lessThanOrEqualToSystemSpacingBelow:multiplier:))

Returns a constraint that defines the maximum distance by which the current anchor is positioned below the specified anchor.

[Creating self-sizing table view cells](/documentation/UIKit/creating-self-sizing-table-view-cells)

Create table view cells that support Dynamic Type and use system spacing constraints to adjust the spacing surrounding text labels.

### Creating a layout dimension

[`-  anchorWithOffsetToAnchor:`](/documentation/UIKit/NSLayoutYAxisAnchor/anchorWithOffset(to:))

Creates a layout dimension object from two anchors.

## See Also

[`NSLayoutConstraint`](/documentation/UIKit/NSLayoutConstraint)

The relationship between two user interface objects that must be satisfied by the constraint-based layout system.

  [Auto Layout Guide](https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/index.html?language=swift#//apple_ref/doc/uid/TP40010853)

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Sendable`](/documentation/Swift/Sendable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCopying`](/documentation/Foundation/NSCopying)

### Inherits From

[`NSLayoutAnchor`](/documentation/UIKit/NSLayoutAnchor)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)