title: Retrieve all images from NSDocumentDirectory and storing into an array
body: <p>Currently i'm using these codes to save my images into NSDocumentDirectory. I use this counter as the naming convention for them.</p>
  
  <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo 
  {
    [self.popoverController dismissPopoverAnimated:YES];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir = [paths objectAtIndex:0];
    NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"%d.png", counter]];
    UIImage *image = imageView.image;
    NSData *imageData = UIImagePNGRepresentation(image);
    [imageData writeToFile:savedImagePath atomically:NO];
  }
  </code></pre>
  
  <p>I use this method because it's easier for me to retrieve all of them by using a loop. I want to retrieve all the images from the NSDocumentDirectory so that i can display them in another view. The following codes show how i retrieve them.</p>
  
  <pre><code>-(NSMutableArray *)GetImage:(NSMutableArray *)arrayImgNames
  {
    NSMutableArray *tempArray;
    for(int i=0;i&lt;[arrayImgNames count]; i++)
    {
      NSArray *paths1 = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths1 objectAtIndex:0];
      NSString *filePath = [documentsDirectory stringByAppendingPathComponent: [arrayImgNames objectAtIndex:i]];
      [tempArray addObject:[[UIImage alloc] initWithContentsOfFile:filePath]];
      return tempArray;
    }
  }
  </code></pre>
  
  <p>However, i do not wish to use the counter as a naming convention for my images. I want to use proper names for them but if i do so, i will have to change my method of retrieving all the images.</p>
  
  <p>Is there any other way that i can retrieve all images other than this method i mentioned?</p>