How Intrinsic Content Size helps me to know my View profoundly!
I wonder why only two constraints are enough for label but not for view in auto layout, though we know the general rule:
Auto Layout to render the scene and size of a view correctly, Auto Layout mechanism must know or able to calculate the :
- x position of a view
- y position of a view
- Width of a view
- Height of a view precisely.
So, what is Intrinsic Content Size of View?
From where my label took its width and height?
So some views have a natural size given their current content. A label’s intrinsic content size is based on the amount of text shown and the font used. For example, for our given view we are not forcefully given it height and width.
But didn’t it give us one more question in our mind? What if the available space is lot so smaller/larger than our intrinsic content size?
The answer is the whole new vast topic that is content compression resistance priority and a content hugging priority
The intrinsic content size help me to reduce my constraint in the view and simplify it.
Hope it help you too!