Content Compression Resistance Priority
When you placed a UILabel in the header of UITableView. And you want to extend the line count dynamically by the label content. Here is what you need.
Set the line as “0”
If you write code rather than set the value in Storyboard, “numberOfLines” is the property name.
myLabel.numberOfLines = 0
And this is a code to adjust height
When you change the content in the header view, you call this extension method to adjust the height value of the header.
But there could be an unexpected shrinking of size like this.
My label has been shrunk, and it’s not showing the full contents.
What you need on this situation is increasing the Content Compression Resistance Priority.
Select your label, and put up the value than the default ‘high: 750’
Finally, the label present full of contents