Skip to content

Instantly share code, notes, and snippets.

@muukii
Created July 19, 2014 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muukii/d818a80e7fb0ab176c63 to your computer and use it in GitHub Desktop.
Save muukii/d818a80e7fb0ab176c63 to your computer and use it in GitHub Desktop.
Autolayout : UITableViewCell : size
+ (CGFloat)heightOfCellWithTableView:(UITableView *)tableView obj:(id)obj
{
static MMCell *sizingCell = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sizingCell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
});
sizingCell.obj = obj;
CGSize size = [sizingCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
return size.height;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment