iPhone and NSUserDefaults

后端 未结 2 960
一生所求
一生所求 2021-01-07 05:25

In my viewWillLoad: method I\'m currently doing something along these lines:

- (void)viewWillAppear:(BOOL)animated {
   NSUserDefaults *defaults = [         


        
2条回答
  •  春和景丽
    2021-01-07 05:57

    Using the initialize method works but I like this other answer on stackoverflow that has code to read the default values from the bundle and uses them to initialize the defaults. That way you don't have to hardcode the default settings in the code, they are in the plist where they belong.

提交回复
热议问题