UIButton.titleLabel裁剪文本问题
希望我能得到一些帮助来解决 UILabel 的一个相当模糊的问题。我不断遇到字符剪辑问题。下面链接中的图像中的字体是 baskerville-bolditalic。黄色是 UIButton 渲染的矩形。黄色是 UIButton 的 titleLabel.backgroundColor。
http://img5.imageshack.us/img5/2381/screenshot20100813at235.png
这是代码:
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;
也许我只是误解了 adjustmentFontSizeToFitWidth。提前非常感谢!
Hope I can get some help with a rather obscure problem with UILabel. I keep getting problems with clipping of characters. The font in the image at the link below is baskerville-bolditalic. The yellow is the rect that the UIButton is rendered in. The yellow is the UIButton's 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'm just misunderstanding adjustsFontSizeToFitWidth. Thanks a ton in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论