【发布时间】:2013-10-31 05:35:11
【问题描述】:
我的应用有一个格式化为 NSAttributedString 的 UILabel 属性:'NSKernAttributeName @1.9,'
- 在运行 IOS6 的 iPad 上编译以下代码时,kern 可以正常工作。
- 在运行 IOS7 的 iPad 上编译时,不会发生字距调整。
我已在 Apple Developer 网站上提交了 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;
【问题讨论】:
-
我在 iOS6 中工作时遇到同样的问题,而在 iOS7 中不工作。我不像你那样使用 UILabel,而是使用低级 CoreText。你收到苹果的回音了吗?他们接受你的错误了吗?
-
Apple 还没有任何消息。
-
如果有人需要解决方案,请在此处查看:stackoverflow.com/questions/20580736/…
标签: ios7