I have UILabel
that the text is dynamically change based on server data. Sometime the data is so long that make my UILabel
become multiline. Is the
If you are using Autolayout then no need to calculate height, just add leading,top and trailing constraint, set number of line to 0 for that label and line break mode to word-wrap, it will automatically update its height.
P.S. Add the bottom contraints too if there is any other control in nib after label.
You can use this :
var labelHeight : CGFloat
labelHeight = theLabel.boundingHeightForFixedWidth(theLabel.bounds.width)
Hope it help :)