-
-
Save maninp/02ca2d62c9c2f03556d9 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