Instance Property

hasEqualSpacing

A Boolean value that indicates whether the spacing between adjacent views should equal each other.

Declaration

@property BOOL hasEqualSpacing;

Discussion

The distances between adjacent views in a stack view are either constrained to equal each other or settable to custom spacings using the setCustomSpacing:afterView: method. The default value for the hasEqualSpacing property is NO, which enables custom spacing. To require equal spacing, set this property to YES, which disables the setCustomSpacing:afterView: method.

With hasEqualSpacing set to NO (the default), the Auto Layout constraints for spacing between views in a gravity area are as shown in table Table 1, in the description of the spacing property.

If you specify equal spacing, the system changes these constraints to the values shown in table Table 1.

Table 1

Inter-view spacing constraints when equal spacing is enabled

Constraint

Value for constraint priority

inter-view spacing == the spacing property

hugging priority

inter-view spacing the spacing property

NSLayoutPriorityRequired

Equal inter-view spacing

NSLayoutPriorityDefaultLow

Stack view hugging priority, identified as the constraint value in row 1, has the default valueNSLayoutPriorityDefaultLow. You can adjust hugging priority by using the setHuggingPriority:forOrientation: method.

See Also

Configuring the Stack View Layout

orientation

The horizontal or vertical layout direction of the stack view.

NSUserInterfaceLayoutOrientation

The two stack view layout directions and, for clipping resistance and hugging priority, the two user interface axes.

alignment

The view alignment within the stack view.

spacing

The minimum spacing, in points, between adjacent views in the stack view.

edgeInsets

The geometric padding inside the stack view, surrounding its views, in points.