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

THLabel not fitting Label Box #25

Closed
sambudda opened this issue Sep 26, 2014 · 3 comments
Closed

THLabel not fitting Label Box #25

sambudda opened this issue Sep 26, 2014 · 3 comments

Comments

@sambudda
Copy link

I have defined a THLabel programmatically as follows.

THLabel *labelValue4 = [[THLabel alloc] initWithFrame:CGRectMake(20,269,300,85)];
labelValue4.text = @"Spectacular";
labelValue4.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size: 57.0];
labelValue4.textColor = [UIColor colorWithRed:52/255.f green:152/255.f blue:255/255.f alpha:1.0];
labelValue4.textAlignment = NSTextAlignmentLeft;
labelValue4.numberOfLines = 1;
labelValue4.backgroundColor = [UIColor clearColor];
labelValue4.strokeColor = [UIColor blackColor];
labelValue4.strokeSize = 1.0;
[self.view addSubview:labelValue4];

What I want is if the word is large like "spectacular" then it should adjust the size of the font automatically but it doesn't. It just chops off the word. How can I fix that? By the way really nice with THLabel.
ios simulator screen shot sep 26 2014 5 47 47 pm

Or I get this for labelValue4.text = @"Partly Cloudy";
dot dot dot
ios simulator screen shot sep 26 2014 6 10 30 pm

@tobihagemann
Copy link
Owner

This is definitively a known issue. THLabel is using Core Text for drawing and I'm not aware of a simple solution like UILabel's adjustsFontSizeToFitWidth or minimumScaleFactor. Also numberOfLines is being ignored by THLabel. I'll look into this issue again, but I couldn't find anything the last time. The solution for now is probably to set a fixed lower font size.

@pronebird
Copy link
Contributor

Does THLabel support adjustsFontSizeToFitWidth?

@tobihagemann
Copy link
Owner

As I've mentioned unfortunately not, sorry.

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

3 participants