+ (
void
)SaveImageToLocal:(UIImage*)image Keys:(
NSString
*)key {
NSUserDefaults
* preferences = [
NSUserDefaults
standardUserDefaults];
[preferences setObject:UIImagePNGRepresentation(image) forKey:key];
}
+ (
BOOL
)LocalHaveImage:(
NSString
*)key {
NSUserDefaults
* preferences = [
NSUserDefaults
standardUserDefaults];
NSData
* imageData = [preferences objectForKey:key];
if
(imageData) {
return
YES
;
}
return
NO
;
}
+ (UIImage*)GetImageFromLocal:(
NSString
*)key {
NSUserDefaults
* preferences = [
NSUserDefaults
standardUserDefaults];
NSData
* imageData = [preferences objectForKey:key];
UIImage* image;
if
(imageData) {
image = [UIImage imageWithData:imageData];
}
else
{
NSLog
(@
"未从本地获得图片"
);
}
return
image;
}