在iOS中设置参数的缺省值

来源:互联网 发布:在线学英语口语软件 编辑:程序博客网 时间:2024/06/05 17:54

NSUserDefaults’ registerDefaults: method. This method takes a dictionary of values; these values will become the default selections in the preferences. Also, it’s safe to use, as it won’t overwrite settings that have been modified by the user.

 

You’ll typically call this method at launch time . You can call it in many places in the app without any issues, but I tend to prefer having a single point for registering all defaults, because it gives us a clearer picture of the available preferences we need to support.

 

https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html%23//apple_ref/doc/uid/TP40003764