Instance Property

intrinsicContentSize

The natural size for the receiving view, considering only properties of the view itself.

Declaration

@property(nonatomic, readonly) CGSize intrinsicContentSize;

Discussion

Custom views typically have content that they display of which the layout system is unaware. Setting this property allows a custom view to communicate to the layout system what size it would like to be based on its content. This intrinsic size must be independent of the content frame, because there’s no way to dynamically communicate a changed width to the layout system based on a changed height, for example.

If a custom view has no intrinsic size for a given dimension, it can use UIViewNoIntrinsicMetric for that dimension.

See Also

Measuring in Auto Layout

- systemLayoutSizeFittingSize:

Returns the optimal size of the view based on its current constraints.

- systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:

Returns the optimal size of the view based on its constraints and the specified fitting priorities.

- invalidateIntrinsicContentSize

Invalidates the view’s intrinsic content size.

- contentCompressionResistancePriorityForAxis:

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

- setContentCompressionResistancePriority:forAxis:

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

- contentHuggingPriorityForAxis:

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

- setContentHuggingPriority:forAxis:

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