如何获取货币符号
How to get the currency symbol
我正在尝试将货币符号传递给 UILabel
。当我尝试获取符号时,我得到了奇怪的结果。这是我的代码:
self.currencyFormatter = [[NSNumberFormatter alloc] init];
[self.currencyFormatter setLocale:[NSLocale currentLocale]];
[self.currencyFormatter setMaximumFractionDigits:2];
[self.currencyFormatter setMinimumFractionDigits:2];
[self.currencyFormatter setAlwaysShowsDecimalSeparator:YES];
[self.currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
NSLog(@"%@", self.currencyFormatter.positiveFormat);
NSLog
的输出是:¤#,##0.00
。我正在尝试获取 $
.
如何获得 $
(美国)?
您要查找的 属性 名为 currencySymbol
. Or possibly internationalCurrencySymbol
。
我正在尝试将货币符号传递给 UILabel
。当我尝试获取符号时,我得到了奇怪的结果。这是我的代码:
self.currencyFormatter = [[NSNumberFormatter alloc] init];
[self.currencyFormatter setLocale:[NSLocale currentLocale]];
[self.currencyFormatter setMaximumFractionDigits:2];
[self.currencyFormatter setMinimumFractionDigits:2];
[self.currencyFormatter setAlwaysShowsDecimalSeparator:YES];
[self.currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
NSLog(@"%@", self.currencyFormatter.positiveFormat);
NSLog
的输出是:¤#,##0.00
。我正在尝试获取 $
.
如何获得 $
(美国)?
您要查找的 属性 名为 currencySymbol
. Or possibly internationalCurrencySymbol
。