NSNumberFormatter货币在iOS 5.1和6.x中的显示方式不同

时间:2013-03-21 11:09:17

标签: ios nsnumberformatter

我目前正在开发一款必须显示依赖于某种文化的货币的应用,我的代码是:

NSLocale* myLocale= [[NSLocale alloc] initWithLocaleIdentifier:myCurrency];
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:myLocale];
[formatter setGroupingSize:3];
[formatter setAlwaysShowsDecimalSeparator:NO];
[formatter setUsesGroupingSeparator:YES];
NSString *formattedString = [formatter stringFromNumber:[NSNumber numberWithFloat:myNumber]];

myNumber = 1450.79

myCurrency = @“es-ES”(或@“es_ES”) iOS 5.1:“€1.450,79” iOS 6.0:“1.450,79€”

myCurrency = @“en-US”(或@“en_US”) iOS 5.1:“1,450.79美元” iOS 6.0:“$ 1,450.79”

myCurrency = @“de-DE”(或@“de_DE”) iOS 5.1:“1.450,79€” iOS 6.0:“1.450,79€”

据我所知,iOS在5.1中没有es-ES(西班牙)的语言环境?

0 个答案:

没有答案