jdg/MBProgressHUD — Issue #28: Impossible to show detailsLabel with more than one line
Author: arielcamus
Created: 2011-11-09 03:54:37+00:00
State: open

I think that the detailsLabel height is being calculated in a wrong way because you use the current label height for the sizeWithFont method in stead of leaving the max height allowed.

Wrong way:
CGFloat maxHeight = frame.size.height - self.height - 2*margin;
CGSize labelSize = [detailsLabel.text sizeWithFont:detailsLabel.font constrainedToSize:CGSizeMake(frame.size.width - 4*margin, maxHeight) lineBreakMode:detailsLabel.lineBreakMode];

It should be:

CGFloat maxHeight = 200; // Or the max height we want to allow
CGSize labelSize = [detailsLabel.text sizeWithFont:detailsLabel.font constrainedToSize:CGSizeMake(frame.size.width - 4*margin, maxHeight) lineBreakMode:detailsLabel.lineBreakMode];