Skip to content

How to get the text height? #14

@pec1985

Description

@pec1985

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions