About User Default

How to use NSUserDefaults

  • instance
    • NSUserDefaults *d = [NSUserDefaults standardUserDefaults];
  • setXXX type --- for *** Write ***
    • [d setInteger:20 forKey:@"intKey"];
  • getXXX type --- for *** Read ***
    • NSInteger str = [d integerForKey:@"intKey"];
  • 同步 synchronize
    • [d synchronize];

你可能感兴趣的:(About User Default)