Created
March 13, 2014 21:14
-
-
Save tylerhargett/9537106 to your computer and use it in GitHub Desktop.
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)heightOfCellWithIngredientLine:(NSString *)ingredientLine maxSize:(CGSize)max labelFont:(UIFont*)font | |
{ | |
NSStringDrawingContext *context = [[NSStringDrawingContext alloc] init]; | |
CGRect labelRect = [ingredientLine boundingRectWithSize:max | |
options:NSStringDrawingUsesLineFragmentOrigin | |
attributes:@{NSFontAttributeName:font} | |
context:context]; | |
// return the calculated required height of the cell considering the label | |
return labelRect.size.height; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment