Enumeration

NSStackViewGravity

The various gravity areas available in a stack view.

Declaration

typedef enum NSStackViewGravity : NSInteger {
    ...
} NSStackViewGravity;

Overview

The layout of a stack view is partitioned into three distinct areas in which you can place views. These are known as gravity areas. You can use these constants to configure a stack view by way of the insertView:atIndex:inGravity: and setViews:inGravity: methods.

In a horizontally oriented stack view, the three gravity areas are NSStackViewGravityLeading, NSStackViewGravityCenter, and NSStackViewGravityTrailing. The ordering of these areas depends on the user interface language, unless you’ve explicitly specified the stack view’s user interface layout direction by calling the inherited userInterfaceLayoutDirection method. For a userInterfaceLayoutDirection property value of NSUserInterfaceLayoutDirectionLeftToRight, the leading gravity area is on the left.

In a vertically oriented stack view, the three gravity areas are always NSStackViewGravityTop, NSStackViewGravityCenter, and NSStackViewGravityBottom.

The center gravity area is constrained to remain geometrically centered with an Auto Layout priority of NSLayoutPriorityDefaultLow. For information about geometric spacing between gravity areas, see the description of the spacing property.

Topics

Constants

NSStackViewGravityTop

The topmost gravity area in a vertically oriented stack view.

NSStackViewGravityLeading

The leftmost or rightmost gravity area in a horizontally oriented stack view, depending on the user interface language or on the explicitly set user interface layout direction.

NSStackViewGravityCenter

The center gravity area, regardless of stack view layout direction and regardless of the user interface language.

NSStackViewGravityBottom

The bottommost gravity area in a vertically oriented stack view.

NSStackViewGravityTrailing

The leftmost or rightmost gravity area in a horizontally oriented stack view, depending on the user interface language or on the explicitly set user interface layout direction.