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

setResizeToFitText does not work #10

Open
gon opened this issue Mar 20, 2012 · 1 comment
Open

setResizeToFitText does not work #10

gon opened this issue Mar 20, 2012 · 1 comment

Comments

@gon
Copy link

gon commented Mar 20, 2012

Hi guys!

I can't make setResizeToFitText work.

I'm pasting in the code from the documentation, and that does not seem to work either.
What am I doing wrong?

Thanks,
Gon

MTLabel *label = [MTLabel labelWithFrame:CGRectMake(20, 150, 250, 70)
andText:@"Hello!"];
[label setTextAlignment:MTLabelTextAlignmentCenter];
[label setFont:[UIFont boldSystemFontOfSize:15]];
[label setFontColor:[UIColor blueColor]];
[label setLineHeight:20];
[label setResizeToFitText:YES];
[self.view addSubview:label];

@jpstuehler
Copy link

It looks like setResizeToFitText only applies when the frame you set at the beginning is smaller than the frame the actual label takes.

That means it won't resize the label to the text height when you start of with a height of 70.

@Tuszy Maybe this functionality needs better documentation. I think the logic behind the decision to only resize when the label was specified smaller than it needs to be makes sense.

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

2 participants