iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Hector01
V2EX  ›  iDev

请问实现单位的国际化该怎么设计呢?

  •  
  •   Hector01 · Dec 30, 2013 · 3892 views
    This topic created in 4518 days ago, the information mentioned may be changed or developed.
    在一个天气app中,可以设置为显示摄氏度,也可以设置为显示华氏度,请问实现这样的功能有什么好的办法吗?我目前只知道设置一个全局变量,然后每次 if-else 这样来更新 Label,感觉应该有更好的办法吧?请各位朋友指教 :-D
    Supplement 1  ·  Dec 30, 2013
    找到解决方案了,用plist,创建一个.plist文件作为配置文件,存入字典就ok了~
    8 replies    1970-01-01 08:00:00 +08:00
    wezzard
        1
    wezzard  
       Dec 30, 2013
    可以用一个singleton的对象来保存这种偏好设置之类的值。
    Hector01
        2
    Hector01  
    OP
       Dec 30, 2013
    @wezzard 额,可是这样下次打开程序的时候值就没了...
    wezzard
        3
    wezzard  
       Dec 30, 2013   ❤️ 1
    @Hector01 做持久化啊
    Hector01
        4
    Hector01  
    OP
       Dec 30, 2013
    @wezzard soga!原来配置文件也是持久化的一种。话说我之前没听说过持久化这个词.. orz
    PrideChung
        5
    PrideChung  
       Dec 30, 2013
    要不要搞这么复杂,用NSUserDefaults
    Hector01
        6
    Hector01  
    OP
       Dec 31, 2013
    @PrideChung NSUserDefaults就是用plist吧
    PrideChung
        7
    PrideChung  
       Dec 31, 2013   ❤️ 1
    @Hector01 是啊,但用NSUserDefaults就不用自己去找系统的Library或者Documents文件夹的路径了,那个API我用一次头疼一次。再说NSUserDefaults本来就是让你用来干这事的,干嘛不用。
    Hector01
        8
    Hector01  
    OP
       Jan 5, 2014
    @PrideChung 即使那样搞也比core data的其他部分方便多了,core data好复杂……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3227 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 13:27 · PVG 21:27 · LAX 06:27 · JFK 09:27
    ♥ Do have faith in what you're doing.