我的应用程序有一个UILabel,格式为NSAttributedString,属性是:“NSKernAttributeName @1.9,”
我已经在苹果开发者的网站上注册了Bug。#15108371 -还没有回应
NSString *formattedNumber;
NSNumber *scoreNum = [[NSNumber alloc] initWithLongLong:thisScore];
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = NSNumberFormatterPadBeforeSuffix;
formatter.formatWidth = 10;
formatter.paddingCharacter = @"0";
formatter.numberStyle = NSNumberFormatterDecimalStyle;
formatter.usesGroupingSeparator = NO;
formattedNumber = [formatter stringFromNumber:scoreNum];
//Creat atributed string of formated number.
NSShadow *textShadow = [[NSShadow alloc] init];
textShadow.shadowColor = [UIColor colorWithRed:0.5 green:0.7 blue:1 alpha:1.0];
textShadow.shadowBlurRadius = 5.0;
textShadow.shadowOffset = CGSizeMake(0,0);
NSAttributedString *pHighScoreStyle = [[NSAttributedString alloc] initWithString:formattedNumber attributes: @{
NSFontAttributeName: [UIFont fontWithName:@"courier" size:16],
NSForegroundColorAttributeName: [UIColor colorWithRed:0.6 green:0.8 blue:1.0 alpha:0.8],
NSKernAttributeName: @1.9,
NSShadowAttributeName: textShadow } ];
//Change the disply value.
runningScore.attributedText = pHighScoreStyle;发布于 2013-10-30 21:21:33
好的。我也有同样的问题(见上面的评论)。这取决于字体(我也使用了快递)。由于一些奇怪的原因,Courier不支持kerning (在iOS7!)。使用CourierNewPSMT,一切都按预期工作,.至少对我来说。
顺便说一句:这是iphone上的字体列表:http://iosfonts.com/
https://stackoverflow.com/questions/19253442
复制相似问题