Skip to content

Instantly share code, notes, and snippets.

@kjkasi
Created December 3, 2015 14:54
Show Gist options
  • Save kjkasi/9662a4919b14890007dd to your computer and use it in GitHub Desktop.
Save kjkasi/9662a4919b14890007dd to your computer and use it in GitHub Desktop.
+ (CGFloat)heightForCellWithPost:(Post *)post {
return (CGFloat)fmaxf(70.0f, (float)[self detailTextHeight:post.text] + 45.0f);
}
+ (CGFloat)detailTextHeight:(NSString *)text {
CGRect rectToFit = [text boundingRectWithSize:CGSizeMake(240.0f, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12.0f]} context:nil];
return rectToFit.size.height;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment