AliSoftware/OHAttributedLabel — Issue #49: adjustsFontSizeToFitWidth not working?
Author: menetwork-erik
Created: 2011-10-28 21:20:32+00:00
State: open

Why is it that the adjustsFontSizeToFitWidth is not working?

OHAttributedLabel *lbl = [[[OHAttributedLabel alloc] initWithFrame:aCGRect] autorelease];
lbl.numberOfLines = 1;
lbl.backgroundColor = [UIColor clearColor];
lbl.adjustsFontSizeToFitWidth = YES;
lbl.text = strVar;

NSMutableAttributedString* attrStr = [lbl.attributedText mutableCopy];
[attrStr setTextColor:phone.textColor];
[attrStr setFont:aFont];
[attrStr addAttribute:(NSString*)kCTUnderlineStyleAttributeName value:[NSNumber numberWithInt:kCTUnderlineStyleSingle|kCTUnderlinePatternSolid] range:[name.text rangeOfString:name.text]];
lbl.attributedText = attrStr;
[attrStr release];

[cell addSubview:lbl];