Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the text height? #14

Open
pec1985 opened this issue Jul 22, 2012 · 0 comments
Open

How to get the text height? #14

pec1985 opened this issue Jul 22, 2012 · 0 comments

Comments

@pec1985
Copy link

pec1985 commented Jul 22, 2012

I have a bunch of UILabels in a scrollview. I just replaced them with these, how do i get the height of the text?

This works for normal labels:

static CGFloat getLabelHeight(MTLabel *label, CGFloat width)
{
    CGSize size = [[label text] sizeWithFont: [label font]
                           constrainedToSize: CGSizeMake(width,CGFLOAT_MAX)
                               lineBreakMode: UILineBreakModeWordWrap];
    return size.height;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant