实际上,我想显示所有货币代码的货币符号,我正在使用这样的代码,但我只得到“$”符号
-(void) showCurrenciesList
{
NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init];
[numFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
//[numFormatter setLocale: [NSLocale currentLocale]];
NSMutableArray *aryAllCurrencies = [[NSMutableArray alloc] init];
//NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier: @"en_US"] autorelease];
NSArray *currencyArray = [NSLocale ISOCurrencyCodes];
NSLog(@"Currency array : %@",currencyArray);
for (NSString *currencyCode in currencyArray)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[numFormatter setCurrencyCode:currencyCode];
NSString *currencySymbol = [numFormatter currencySymbol];
[aryAllCurrencies addObject:currencySymbol];
[pool release];
}
//[countriesArray sortUsingSelector:@selector(compare:)];
NSLog(@"currencies array : %@",aryAllCurrencies);
}
这是正确的还是有其他方法可以做到这一点?