偏好设置的工具方法
+ (void)setObject:(id)value forKey:(NSString *)key{
[[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+ (id)objectForKey:(NSString *)key{
return [[NSUserDefaults standardUserDefaults] objectForKey:key];
}
例子: 是否展示过版本新特性,也即是引导页
-(void)setBShowIntroduce:(BOOL)bShowIntroduce
{
// [SessionMgr Instance].strOrderAmount = bShowIntroduce;
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:bShowIntroduce] forKey:@"bShowIntroduce"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
/**
此版本是否提示过文案
*/
-(BOOL)bShowIntroduce
{
// return [SessionMgr Instance].strOrderAmount;
NSNumber *numShowIntroduce = [[NSUserDefaults standardUserDefaults] objectForKey: @"bShowIntroduce"];
return [numShowIntroduce boolValue];
}
作者:u011018979 发表于2017/7/3 15:25:29 原文链接
阅读:73 评论:0 查看评论