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
/** | |
* Calculate height for a fixed weidht label | |
* @param UILabel for which height to be calculated | |
**/ | |
-(double)getLabelHeightForLabel:(UILabel *)label{ | |
CGSize constrainedSize = CGSizeMake(label.frame.size.width, 1000); | |
NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys: label.font, NSFontAttributeName,nil]; | |
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:label.text attributes:attributesDictionary]; | |
CGRect requiredHeight = [string boundingRectWithSize:constrainedSize options:NSStringDrawingUsesLineFragmentOrigin context:nil]; |