sizeToFit will make a label adjust its frame to the correct size to hold its text. There's a gotcha that if the text is empty @"" sizeToFit will set the frame size to empty. All further calls to sizeToFit will not make the frame bigger anymore. To fix this you need to set the frame to some real size, like the original frame size, before calling sizeToFit.
Obviously there's no sense in trying to calculate the size of a label if it doesn't yet have the text that it's going to display. Set the text and then call layoutSubviews.
|