user1486548
user1486548

Reputation: 1201

iOS: How to tell if UILabel's font has been auto-resized?

Is there a way to programmatically determine whether the text within a label has been auto-resized?

Upvotes: 2

Views: 167

Answers (1)

rooster117
rooster117

Reputation: 5552

You could probably check the size of the text with the font and compare it to the label's width.

Maybe something like this:

CGSize size = [yourLabel.text sizeWithFont:label.font constrainedToSize:CGSizeMake(100000, yourLabel.frame.size.height)  lineBreakMode:yourLabel.lineBreakMode];

if(size.width > label.frame.size.width)
{
    //you are being autosized
}

Upvotes: 2

Related Questions