Hope I can help a little with a rather obscure issue with UILabel. I have problems cropping characters. The font in the image at the link below is baskerville-bolditalic. Yellow is the rectangle in which the UIButton is placed. Yellow is the UIButton titleLabel.backgroundColor.
http://img5.imageshack.us/img5/2381/screenshot20100813at235.png
Here is the code:
UIButton * currentCharacter = [UIButton buttonWithType:UIButtonTypeCustom]; currentCharacter.frame = cFrame; currentCharacter.backgroundColor = [UIColor blueColor]; currentCharacter.titleLabel.backgroundColor = [UIColor yellowColor]; currentCharacter.titleLabel.numberOfLines = 1; currentCharacter.titleLabel.adjustsFontSizeToFitWidth = YES; currentCharacter.titleLabel.minimumFontSize = 1; currentCharacter.titleLabel.font = currentFont; currentCharacter.titleLabel.clipsToBounds = NO; currentCharacter.clipsToBounds = NO; currentCharacter.titleLabel.textAlignment = UITextAlignmentCenter; currentCharacter.titleLabel.adjustsFontSizeToFitWidth = YES;
Maybe I just misunderstand adjustsFontSizeToFitWidth. Thanks for the ton in advance!
source share