title: Save and Get image from plist
body: <p>I am developing one app in that getting images from array and display vertically in ScrollView.</p>
  
  <p>when user double tapped on particular image i want that exact image store into plist according to tag value of that image, and retrieve that image later on when require.</p>
  
  <p>i tried this one </p>
  
  <pre><code>//  Store Data into plist.
  
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                           NSUserDomainMask,
                                                           YES);
      NSString *path = [NSString stringWithFormat:@"%@/myPlist.plist",
                        [paths objectAtIndex:0]];
  
      // Place an image in a dictionary that will be stored as a plist
  
      NSMutableDictionary * dictionary=[[NSMutableDictionary alloc]init];
  
  
      [dictionary setObject:ImgView.tag forKey:@"image"];
  
      NSLog(@"%@",dictionary);
  
      // Write the dictionary to the filesystem as a plist
      [NSKeyedArchiver archiveRootObject:dictionary toFile:path];
  </code></pre>
  
  <p>// For getting data from NSmutable array store it to the scrollview.</p>
  
  <pre><code>int m=0;
  
  AppDelegate * delegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
  
  delegate.front=TRUE;
  delegate.back=FALSE;
  
  UIScrollView *scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
  
  [scrollView setPagingEnabled:YES];
  
  [scrollView setShowsHorizontalScrollIndicator:NO];
  
  FrontsCards=[[NSMutableArray alloc]initWithObjects:@"cloub1.png",@"cloub2.png",@"cloub3.png",@"cloub4.png",@"cloub5.png",@"cloub6.png",@"cloub7.png",@"cloub8.png",@"cloub9.png",@"cloub10.png",@"cloub11.png",@"cloub12.png",@"diamond1.png",@"diamond2.png",@"diamond3.png",@"diamond4.png",@"diamond5.png", nil];
  
  
  
  
  for(m=0; m&lt;[FrontsCards count];m++)
  {
  
      ImgView.alpha=1;
  
      ImgView.tag=m;
  
      int randIdx=arc4random()%[FrontsCards count];
  
      NSString *imageName=[FrontsCards objectAtIndex:randIdx];
  
      NSString *fullImageName=[NSString stringWithFormat:@"%@",imageName];
  
      int padding=0;
  
      CGRect imageViewFrame=CGRectMake(scrollView.frame.size.width*m+padding, scrollView.frame.origin.y, scrollView.frame.size.width-2*padding, scrollView.frame.size.height);
  
      ImgView=[[UIImageView alloc]initWithFrame:imageViewFrame];
  
      [ImgView setImage:[UIImage imageNamed:fullImageName]];
  
  
  
  
      NSLog(@"%d",m);
  
      // Place an image in a dictionary that will be stored as a plist
      //[dictionary setObject:image forKey:@"image"];
  
      // Write the dictionary to the filesystem as a plist
      //[NSKeyedArchiver archiveRootObject:dictionary toFile:path];
  
  
  
      [scrollView addSubview:ImgView];
  
  
      UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTapImgView:)];
      doubleTap.numberOfTapsRequired = 2;
      doubleTap.delegate = self;
  
      [self.ImgView addGestureRecognizer:doubleTap];
  
      self.ImgView.userInteractionEnabled=YES;
  
  }
  
  CGSize scrollViewSize=CGSizeMake(scrollView.frame.size.width*[FrontsCards count], scrollView.frame.size.height);
  [scrollView setContentSize:scrollViewSize];
  [self.view addSubview:scrollView];
  </code></pre>
  
  <p>help me out this thanks in advance.</p>