I'm having trouble displaying a multi-line UILabel in a custom UITableView cell.
I'm currently using this to calculate both the height of the cell...
NSString *cellText = [howtoSection objectAtIndex:row];
UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:15.0];
CGSize constraintSize = CGSizeMake(260.0f, MAXFLOAT);
CGSize labelSize = [cellText sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
return labelSize.height + 20;
...and this is for the label itself.
// Calc the height
NSString *cellText = [howtoSection objectAtIndex:row];
CGSize constraintSize = CGSizeMake(260.0f, MAXFLOAT);
CGSize labelSize = [cellText sizeWithFont:cell.textLabel.font constrainedToSize:constraintSize lineBreakMode:cell.textLabel.lineBreakMode];
// Create the label frame
CGRect newFrame = cell.contentLabel.frame;
newFrame.size.height = labelSize.height;
cell.contentLabel.frame = newFrame;
[cell.contentLabel setText:[howtoSection objectAtIndex:row]];
Everything is working as planned except that the label is being pushed down and out of it's cell. If it wasn't for this apparent top margin everything would fit.
Here's a link to a picture of what I'm seeing in the simulator...
Any help here would be greatly appreciated.