Contents

setClippingResistancePriority(_:for:)

Sets the Auto Layout priority for resisting clipping of views in the stack view when Auto Layout attempts to reduce the stack view’s size.

Declaration

func setClippingResistancePriority(_ clippingResistancePriority: NSLayoutConstraint.Priority, for orientation: NSLayoutConstraint.Orientation)

Parameters

  • clippingResistancePriority:

    The clipping resistance Auto Layout priority you want to apply to the stack view for a given user interface axis. The default value is Required, which disallows clipping. Other valid values are those in the Priority Swift.struct enumeration.

  • orientation:

    The horizontal or vertical user interface axis that the clipping resistance priority applies to; one of the constants from the Orientation enumeration.

Discussion

A clipped view is one that is partially hidden beyond the border of its enclosing stack view. When Auto Layout attempts to reduce the stack view’s size (such as when a user attempts to reduce the size of the enclosing window), causing a view to no longer fit, the stack view clips or detaches the view, or else prevents further reduction of the stack view’s size.

To allow view clipping, set a clipping resistance lower than the default value of NSLayoutPriorityRequired and set the visibility priority of all the stack view’s views to mustHold.

To ensure that views detach rather than clip, lower the clipping resistance for the stack view to a value less than the default of required and set the visibility priority for at least one view to a value less than mustHold.

If you disallow view clipping and disallow view detachment, which is the default behavior for a stack view, Auto Layout prevents the stack view from being reduced in size beyond the minimum needed to show all of its views.

Clipping begins from the right and bottom sides of a stack view.

See Also

Related Documentation

Configuring Dynamic Behavior for a Stack View