欢迎来到天天文库
浏览记录
ID:33932340
大小:202.61 KB
页数:21页
时间:2019-03-01
《Data Formatting Guide.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、DataFormattingGuideContentsIntroductiontoDataFormattingProgrammingGuideForCocoa4OrganizationofThisDocument4NumberFormatters5UseFormatterStylestoPresentNumbersWiththeUser’sPreferences5UseFormatStringstoSpecifyCustomFormats6Percentages7Nomenclature7DateFormatters8Us
2、eFormatterStylestoPresentDatesandTimesWiththeUser’sPreferences8UseFormatStringstoSpecifyCustomFormats9FixedFormats9CustomFormatsforUser-VisibleDates10ParsingDateStrings12CacheFormattersforEfficiency13ConsiderUnixFunctionsforFixed-Format,UnlocalizedDates15Formatter
3、sandUserInterfaceElements16AssociatingaFormatterWithaCell16DelegationMethodsforErrorHandling17CreatingaCustomFormatter18DocumentRevisionHistory192012-09-19
4、Copyright©2012AppleInc.AllRightsReserved.2ListingsNumberFormatters5Listing1Formattinganumberusingaformatters
5、tyle5Listing2Formattinganumberusingaformatstring6DateFormatters8Listing1Formattingadateusingformatterstyles9Listing2ParsinganRFC3339date-time12Listing3ParsinganRFC3339date-timeusingacachedformatter132012-09-19
6、Copyright©2012AppleInc.AllRightsReserved.3Introduction
7、toDataFormattingProgrammingGuideForCocoaYouuseformatterstointerpretandcreatestringsthatrepresentotherdatatypes,andtovalidatethetextintextfieldsandothercells.Formattersareinstancesofsubclassesoftheabstractclass,NSFormatter.TheFoundationframeworkprovidestwoconcretes
8、ubclassesofNSFormatter:NSNumberFormatterandNSDateFormatter.(CoreFoundationprovidestwoequivalentopaquetypes:CFNumberFormatterandCFDateFormatter.Thesearesimilarbutarenottoll-freebridged.)YoucancreateasubclassofNSFormatterforcustomformatting.Youshouldreadthisdocument
9、togainabasicunderstandingofhowtocreateandusedateandnumberformatters,andhowyoucancreateacustomformatterobject.OrganizationofThisDocument“DateFormatters”(page8)describeshowtousedateformatters.“NumberFormatters”(page5)describeshowtousenumberformatters.“FormattersandU
10、serInterfaceElements”(page16)describeshowtosetaformatterforauserinterfaceelement,andtheinteractionbetweenanelementanditsformatterinOSX.“CreatingaCustomF
此文档下载收益归作者所有