title: how to convert nsdata to image?
body: <p>I am developing an application in which I take <code>NSData</code> and convert it into image an display it in the image view. Now i want to save this data and display it again in <code>UIImageView</code>.
  I used <code>NSUserDefaults</code> to save the <code>NSData</code> and again retrieve this data and convert into image and display it in image view.But i am not getting the image back.my code is as follows:</p>
  
  <pre><code>//for saving  nsdata using nsuserdefaults method:-
  NSUserDefaults *defsMVC=[NSUserDefaults standardUserDefaults];
  [defsMVC setObject:stateMVC forKey:@"MapImageObject"];
  
  //for retrieving nsdata from nsuserdefaults and display it in imageview
  NSUserDefaults *defsMVC=[NSUserDefaults standardUserDefaults];
  
  NSData *stringmapdata=[defsMVC dataForKey:@"MapImageObject"];
  
  UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 6, 320,415)];
  UIImage *image = [UIImage imageWithData:stringmapdata];
  [imageView setImage:image];
  [image release];
  [self.view addSubview:imageView];
  [self.view sendSubviewToBack:imageView];
  [imageView release];
  </code></pre>