新的 iOS9/OSX10.11 NSNumberFormatterStyle 枚举值是什么意思?
What do the new iOS9/OSX10.11 NSNumberFormatterStyle enum values mean?
iOS 和 OS X NSNumberFormatterStyle
枚举在新的 iOS 9 和 OS X 10.11 SDK 中获得了 4 个新值!它们 听起来 很酷而且很有用,但是 Apple's documentation and even Google 对它们无话可说!
这些新值在传递给公式时有什么作用,它们与旧值有何不同?
在 iOS 9.0 或 OS X 10.11 〉框架 〉基础 〉NSNumberFormatter.h 第 46-57 行:
typedef NS_ENUM(NSUInteger, NSNumberFormatterStyle) {
NSNumberFormatterNoStyle = kCFNumberFormatterNoStyle,
NSNumberFormatterDecimalStyle = kCFNumberFormatterDecimalStyle,
NSNumberFormatterCurrencyStyle = kCFNumberFormatterCurrencyStyle,
NSNumberFormatterPercentStyle = kCFNumberFormatterPercentStyle,
NSNumberFormatterScientificStyle = kCFNumberFormatterScientificStyle,
NSNumberFormatterSpellOutStyle = kCFNumberFormatterSpellOutStyle,
NSNumberFormatterOrdinalStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterOrdinalStyle,
NSNumberFormatterCurrencyISOCodeStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyISOCodeStyle,
NSNumberFormatterCurrencyPluralStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyPluralStyle,
NSNumberFormatterCurrencyAccountingStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyAccountingStyle,
};
看看今年的Session227 - 国际化的新变化(video; text)
视频在 18:34 处进行了解释 - 这是这张特定幻灯片的屏幕截图:
除了现有的 NSNumberFormatterStyles
Apple 在 iOS 9 和 OS X 10.11 中引入了四种新样式。
In addition to the already existing 'currency style, we now have 'currency ISO code style, as well 'currency plural style' and 'currency accounting style.' Interestingly here for 'currency accounting style, if you pass it a negative number, it presents it surrounded by parentheses.
This is common in accounting circles.
想看看这些货币样式是什么样子的,看看上面的图片。
序号样式可用于有序列表。
- 1st Foo
- 第 2 栏
- ...
- 第 42 个 Foo 酒吧
iOS 和 OS X NSNumberFormatterStyle
枚举在新的 iOS 9 和 OS X 10.11 SDK 中获得了 4 个新值!它们 听起来 很酷而且很有用,但是 Apple's documentation and even Google 对它们无话可说!
这些新值在传递给公式时有什么作用,它们与旧值有何不同?
在 iOS 9.0 或 OS X 10.11 〉框架 〉基础 〉NSNumberFormatter.h 第 46-57 行:
typedef NS_ENUM(NSUInteger, NSNumberFormatterStyle) {
NSNumberFormatterNoStyle = kCFNumberFormatterNoStyle,
NSNumberFormatterDecimalStyle = kCFNumberFormatterDecimalStyle,
NSNumberFormatterCurrencyStyle = kCFNumberFormatterCurrencyStyle,
NSNumberFormatterPercentStyle = kCFNumberFormatterPercentStyle,
NSNumberFormatterScientificStyle = kCFNumberFormatterScientificStyle,
NSNumberFormatterSpellOutStyle = kCFNumberFormatterSpellOutStyle,
NSNumberFormatterOrdinalStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterOrdinalStyle,
NSNumberFormatterCurrencyISOCodeStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyISOCodeStyle,
NSNumberFormatterCurrencyPluralStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyPluralStyle,
NSNumberFormatterCurrencyAccountingStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyAccountingStyle,
};
看看今年的Session227 - 国际化的新变化(video; text)
视频在 18:34 处进行了解释 - 这是这张特定幻灯片的屏幕截图:
除了现有的 NSNumberFormatterStyles
Apple 在 iOS 9 和 OS X 10.11 中引入了四种新样式。
In addition to the already existing 'currency style, we now have 'currency ISO code style, as well 'currency plural style' and 'currency accounting style.' Interestingly here for 'currency accounting style, if you pass it a negative number, it presents it surrounded by parentheses. This is common in accounting circles.
想看看这些货币样式是什么样子的,看看上面的图片。 序号样式可用于有序列表。
- 1st Foo
- 第 2 栏
- ...
- 第 42 个 Foo 酒吧