Storing Process :
You can Store values are these methods :
setValue, setURL, setInteger, setDouble, setFloat, setBool, setObject and more........
Example :
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"BoolValue"];
[[NSUserDefaults standardUserDefaults] synchronize];
[[NSUserDefaults standardUserDefaults] setObject:@"str" forKey:@"key"];
[[NSUserDefaults standardUserDefaults] synchronize];
[[NSUserDefaults standardUserDefaults] setInteger:12 forKey:@"Int"];
[[NSUserDefaults standardUserDefaults] synchronize];
Retrive Process :
Example 1:
NSString *String_Str = [[NSUserDefaults standardUserDefaults]boolForKey:@"BoolValue"];
if (!String_Str)
{
//Code
}
else
{
//Code
}
Example 2:
NSString *String_Str1 = [[NSUserDefaults standardUserDefaults]boolForKey:@"key"];
NSLog(String_Str1);
No comments:
Post a Comment