Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(CGFloat)heightForLabel:(UILabel *)label withText:(NSString *)text{
- NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:label.font}];
- CGRect rect = [attributedText boundingRectWithSize:(CGSize){label.frame.size.width, CGFLOAT_MAX}
- options:NSStringDrawingUsesLineFragmentOrigin
- context:nil];
- return ceil(rect.size.height);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement