In my iOS app (Developing for iOS 7 and up ) I have a UItableViewCell
that calculates it height based on the auto layout constraints
I've set and the content of the cell. The code to that works well as for all other cells the height is correct.
However I have a UITableViewCell
that only has a UILabel
in it and this label gets its text via a web service. So its height needs to be calculated at runtime. This is how I setup the constraints
on the UITableViewCell
:
So as you can see I expect the UITableViewCell
height to be based on the text within the UILabel
.
At first the height was too short and my text was cut off. Only after setting preferredMaxLayoutWidth
from Automatic to explicit did the height of the cell incase. However how it's seems the hight is too much. Here is what the UITableViewCell
now looks like at runtime: Lots of whitespace above and below the UILabel
.
Where I am going wrong with my constraints?