Skip to content

Instantly share code, notes, and snippets.

@maninp
Forked from lonelytango/Replace sizeWithFont
Last active August 29, 2015 14:24
Show Gist options
  • Save maninp/08c6723440217f303c0f to your computer and use it in GitHub Desktop.
Save maninp/08c6723440217f303c0f to your computer and use it in GitHub Desktop.
CGSize maximumLabelSize = CGSizeMake(tableView.width, MAXFLOAT);
NSStringDrawingOptions options = NSStringDrawingTruncatesLastVisibleLine |
NSStringDrawingUsesLineFragmentOrigin;
NSDictionary *attr = @{NSFontAttributeName: [UIFont systemFontOfSize:15]};
CGRect labelBounds = [string boundingRectWithSize:maximumLabelSize
options:options
attributes:attr
context:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment