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.
本文介绍如何使用NSUserDefaults的registerDefaults方法来设置应用的默认首选项。该方法接受一个字典参数,其中包含的值将成为偏好设置的默认选项,并且不会覆盖用户的自定义设置。通常推荐在启动时调用此方法,并集中注册所有默认设置以清晰展示需支持的所有偏好设置。
1452

被折叠的 条评论
为什么被折叠?



