我目前正在开发一个必须显示取决于某种文化的货币的应用程序,我的代码是:
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]];
我的号码 = 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(西班牙)的语言环境吗?