3
我写了下面的代码,以显示给定的价格与瑞典货币:如何在IOS显示正确的瑞典货币?
+(NSString *) getPriceStringWithCurrencySymbolFor:(NSNumber *)price{
NSDictionary *components = [NSDictionary dictionaryWithObject:@"sv_SE" forKey:NSLocaleCurrencyCode];
NSString *localeIdentifier = [NSLocale localeIdentifierFromComponents:components];
NSLocale *localeForDefaultCurrency = [[NSLocale alloc] initWithLocaleIdentifier:@"sv_SE"];
NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init];
[currencyFormatter setLocale:localeForDefaultCurrency];
[currencyFormatter setMaximumFractionDigits:2];
[currencyFormatter setMinimumFractionDigits:2];
[currencyFormatter setAlwaysShowsDecimalSeparator:YES];
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
return [currencyFormatter stringFromNumber:price];
}
这表明价格为75:00 KR,而应该表现出75,00 KR。我该如何解决这个问题?
什么样的价值,你传递了'appDelegate.shop.localeCode'? – footyapps27
我编辑过。请检查。 – Burak
我可以复制它,我觉得这是基金会的错误。 –