我正在尝试将货币符号传递给 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
.或者可能 internationalCurrencySymbol
.
关于ios - 如何获取货币符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30791291/