iPhone-NSNumberFormatter问题
我正在使用NSNumberFormatter创建货币格式的字符串。 在大多数设备上一切正常,但在某些设备上,例如使用韩语的设备,$符号显示为矩形iPhone-NSNumberFormatter问题,iphone,objective-c,nsnumberformatter,Iphone,Objective C,Nsnumberformatter,我正在使用NSNumberFormatter创建货币格式的字符串。 在大多数设备上一切正常,但在某些设备上,例如使用韩语的设备,$符号显示为矩形 NSNumberFormatter *currencyStyle = [[NSNumberFormatter alloc] init]; [currencyStyle setFormatterBehavior:NSNumberFormatterBehavior10_4]; [currencyStyle setNumberStyle:NSNumberFo
NSNumberFormatter *currencyStyle = [[NSNumberFormatter alloc] init];
[currencyStyle setFormatterBehavior:NSNumberFormatterBehavior10_4];
[currencyStyle setNumberStyle:NSNumberFormatterCurrencyStyle];
NSNumber *amount = [NSNumber numberWithInteger:moneyAmount];
NSString *amountString = [NSString stringWithFormat:@"%@", [currencyStyle stringFromNumber:amount]];
[currencyStyle release];
有办法解决这个问题吗
Rhanks根据您在问题中的评论,听起来您只需要
$
货币符号,而不管用户当前的语言环境定义了什么货币符号
这是使用NSNumberFormatter
类的-setCurrencySymbol:
实例方法完成的。在您的情况下,您可以执行以下操作:
[currencyStyle setCurrencySymbol:@"$"];
复制品?非常相似,但不是复制品。那个家伙在非英语和非ASCII字符方面有问题。我遇到了一个简单的$符号的问题,它是由任何可用的字体支持的,或者说是由我使用的字体支持的,所以它实际上是在显示韩国货币?很有趣,谢谢