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

TWcode
  • 813
  • 2
  • 13
  • 27

2 Answers2

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

yhpets
  • 87
  • 1
  • 11
0

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

Community
  • 1
  • 1
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
  • [[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 '12 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 '12 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 '12 at 02:24
  • I have totally screwed this up... could you direct me to a tutorial – TWcode Feb 01 '12 at 17:21