0

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"]];

2 Answers 2

0

Pretty much you have to convert it to NSData and vice versa. Take a look at this link: Save images in NSUserDefaults?

4
  • [[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(image) forKey:key]; I think this is what I'm looking for, but where would I include the image and to be saved?
    – TWcode
    Jan 30, 2012 at 19:15
  • You put your UIImage pointer in place of (image) and set a Key that you will use to access your image
    – SimplyKiwi
    Jan 30, 2012 at 22:03
  • in the forKey: parameter just do forKey:@"MyKey" replace key with a nsstring that you can use later on.
    – SimplyKiwi
    Jan 31, 2012 at 2:24
  • I have totally screwed this up... could you direct me to a tutorial
    – TWcode
    Feb 1, 2012 at 17:21
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.