Sim*_*mon 9 objective-c ios nslocale
我可以从NSLocale获取本地货币的代码吗?我试过这个:
NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"fr_FR"] autorelease];
NSString *currencyCode = [locale objectForKey:NSLocaleCurrencyCode];
Run Code Online (Sandbox Code Playgroud)
但currencyCode回复为零(我想要"欧元"或类似).
Mic*_*ann 20
您的代码在常规Macintosh应用程序中对我来说非常好.
NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"fr_FR"] autorelease];
NSString *currencyCode = [locale objectForKey:NSLocaleCurrencyCode];
NSLog( @"currencyCode is %@", currencyCode );
Run Code Online (Sandbox Code Playgroud)
在控制台中显示:
2011-11-14 14:53:33.784 Testing[26388:707] currencyCode is EUR
Run Code Online (Sandbox Code Playgroud)
您是否正在尝试将其构建为命令行(基础)应用程序或非传统类似Mac的应用程序?
| 归档时间: |
|
| 查看次数: |
6381 次 |
| 最近记录: |