Thursday, 8 August 2013

How to get label's height when text goes multiple lines

How to get label's height when text goes multiple lines

I am creating a label programatically in a detail view on table cell
click.aI am setting the text accordingly and set the label height for
that. This is my code :
NSString *mytitleString = [discussionData valueForKey:@"Name"];
CGSize size = [mytitleString sizeWithFont:[UIFont systemFontOfSize:14.0]
constrainedToSize:CGSizeMake(500, CGFLOAT_MAX)];
float lbltitleheight = size.height;
lbltitle.text = mytitleString;
but the problem is i am not able to set the height of lable if it is
multiple line. How do i achieve this?

No comments:

Post a Comment