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
我可以複製它,我覺得這是基金會的錯誤。 –