IT English Collection(2)of Formatter(IOS)
来源:互联网 发布:p2p平台 知乎 编辑:程序博客网 时间:2024/05/17 23:56
1 前言
今天我们介绍一篇关于IOS的格式化官方解释文档。
2 详述
2.1 正文
A formatter is an object that automatically converts a string representation of a value to an object representing that value, andvice versa. For example, an NSNumberFormatter object can convert the string “1.25” to an NSNumber object representing the value 1.25. An NSDateFormatter; objects can convert an NSDate object representing December 12, 2009 to “11/22/2009”. As you can see, the conversion works both ways, from string to value object and value object to string. The abstract base class for formatters is NSFormatter. You may subclass NSFormatter to create formatters for other types of data, even custom data types defined by your application’s data model.
Configuring and Applying a Formatter
When you create a date or number formatter object, you can configure it in many ways, but the primary attributes are formatter style and locale. You can give NSNumberFormatter objects a decimal, currency, percent, scientific, or “spell-out” style (for example, “25” to “twenty-five”). You can give NSDateFormatter objects both date and time styles in a range ofexplicitness, for example, from “11/22/2009” to “Sunday, November 22, 2009 AD”.
You may also apply an NSLocale object to a formatter object so that it reflects a certain locale; for example, “1.02” in U.S. English would be “1,02” in French. To get the currentlocale (set by the user), call the NSLocale class method currentLocale.
After you have configured a date or number formatter, you apply it to a string obtained from the user interface (typically a text field) to obtain the value object; or you apply it to an NSDate or NSNumber object and write the resulting string to an object in the user interface. The methods you call for thesepurposes are dateFromString:, stringFromDate:, numberFromString:, and stringFromNumber:.
2.2 生词汇总
vice [vaɪs]prep. 代替
versa ['vɜ:sə]adj. 反的
explicitness [iks'plisitnis]n. 直言不讳;明确性
reflect [rɪ'flekt]vt. 反映;反射
certain ['sɜːt(ə)n; -tɪn]adj. 某一;必然的;
locale [ləʊ'kɑːl]n. 场所,现场
obtain [əb'teɪn]vt. 获得
purpose ['pɜːpəs]n. 目的;用途
3 结语
以上是所有内容,希望对大家有所帮助。
- IT English Collection(2)of Formatter(IOS)
- IT English Collection(27)of Collection
- IT English Collection(1)of Event(IOS)
- IT English Collection(15)of Outlet
- IT English Collection(29)of Preferences
- IT English Collection(31)of About Drawing and Printing in iOS
- IT English Collection(11)of Object graph
- IT English Collection(21)of Key-value coding
- IT English Collection(22)of Accessor method
- IT English Collection(23)of Declared property
- IT English Collection(24)of View hierarchy
- IT English Collection(28)of Property list
- IT English Collection(9) of Objective-C
- IT English Collection(10) of Object encoding
- IT English Collection(12) of Archiving
- IT English Collection(13) of Nib file
- IT English Collection(14) of Storyboard
- IT English Collection(16) of Message
- c#编程实现word 文档如何导入SQL Server数据库表中
- 火狐与IE的Cookie位置(原)
- 干掉LCD上的闪烁光标
- 网站优化:如何超越竞争对手的核心因素!
- SVN服务器搭建和使用(三)
- IT English Collection(2)of Formatter(IOS)
- linux下Apache正常配置下仍然503的解决办法
- cvCreateVideoWriter
- SOA,现在进行时
- 离你上次出现已有24个小时了
- jquery获取url参数值的方法
- mysql支持的数据类型——字符串类型
- 干货分享:不可错过的网站权重提高方法
- i.MX53的启动模式