Instance Method

setContentHuggingPriority(_:for:)

Sets the priority with which a view resists being made larger than its intrinsic size.

Declaration

func setContentHuggingPriority(_ priority: UILayoutPriority, for axis: UILayoutConstraintAxis)

Parameters

priority

The new priority.

axis

The axis for which the content hugging priority should be set.

Discussion

Custom views should set default values for both orientations on creation, based on their content, typically to UILayoutPriorityDefaultLow or UILayoutPriorityDefaultHigh. When creating user interfaces, the layout designer can modify these priorities for specific views when the overall layout design requires different tradeoffs than the natural priorities of the views being used in the interface.

Subclasses should not override this method.

See Also

Related Symbols

func contentHuggingPriority(for: UILayoutConstraintAxis)

Returns the priority with which a view resists being made larger than its intrinsic size.