I have a grouped UITableView.
I am overriding the table row height, but I would like the first row to have a dynamic height that is based on the size of the height of the Label in my cell. How can I get this height?
{
CGFloat rowHeight = 0;
if(indexPath.section == kBioSection) {
switch(indexPath.row) {
case kBioSectionDescriptionRow:
rowHeight = 100;
break;
case kBioSectionLocationRow:
rowHeight = 44;
break;
case kBioSectionWebsiteRow:
rowHeight = 44;
break;
}
}
else {
rowHeight = 44;
}
return rowHeight;
}
NSString has a method called
declared in
UIStringDrawing.hIt will give you the size required to draw that string.
You can get the height of that required size, and add whatever else you want, like other labels/views, and space between them, to calculate the final height.
Something like this: