Created
October 22, 2013 19:34
-
-
Save johncblandii/7106773 to your computer and use it in GitHub Desktop.
This is a class with static methods for saving user defaults.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Preferences.h" | |
@implementation Preferences | |
+(id)getUserPreference:(NSString*)forKey | |
{ | |
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; | |
return [defaults valueForKey:forKey]; | |
} | |
+(void)setUserPreference:(id)value forKey:(NSString*)key | |
{ | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
[defaults setObject:value forKey:key]; | |
[defaults synchronize]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment