[iOS] How do I save user preferences for my iPhone app?

One of the easiest ways would be saving it in the NSUserDefaults:

Setting:

NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];

[userDefaults setObject:value 
                 forKey:key];
// – setBool:forKey:
// – setFloat:forKey:  
// in your case 
[userDefaults synchronize];

Getting:

[[NSUserDefaults standardUserDefaults] objectForKey:key];

 boolForKey:

相關文章

寫留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *