问题
I have a iPad app that can take a picture and then put it within a image view. How do I go about saving the pic that I have stored in the image view? Here is what I have tried so far: [imageView setImage:[[NSUserDefaults standardUserDefaults] objectForKey:@"storedImageValue6"]];
回答1:
Pretty much you have to convert it to NSData and vice versa. Take a look at this link: Save images in NSUserDefaults?
回答2:
Here imageSet is UIImage
NSData *imagedata=UIImagePNGRepresentation(imageSet);
[[NSUserDefaults standardUserDefaults] setObject:imagedata forKey:@"Theme Selecting"];
[[NSUserDefaults standardUserDefaults] synchronize];
You can use this code for saving image
来源:https://stackoverflow.com/questions/9058825/how-do-you-save-a-picture-with-nsuserdefaults