Created
June 25, 2014 06:42
-
-
Save edwardinubuntu/df555ae8feec5f8d12ec to your computer and use it in GitHub Desktop.
How to calculate cell height.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
LHIdeaGroupCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IdeaGroupCell"]; | |
CGFloat labelWidth = cell.descriptionLabel.width; | |
LHIdeaGroup *currentGroup = [self.objects objectAtIndex:indexPath.row]; | |
CGRect r = [currentGroup.Description boundingRectWithSize:CGSizeMake(labelWidth, 0) | |
options:NSStringDrawingUsesLineFragmentOrigin | |
attributes:@{NSFontAttributeName: cell.descriptionLabel.font} | |
context:nil]; | |
return r.size.height + 60.f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment