I am saving some images in to the documents directory of the app using the following code.
for (int k=0;k<[_imageNames count];k++)
{
NSString *imagePath = [dataPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%d.jpg",k]];
NSData *data = UIImageJPEGRepresentation([_imageNames objectAtIndex:k], 1.0f);
[data writeToFile:imagePath atomically:YES];
}
Now I am trying to load the images sequentially into an NSMutableArray. Can someone point me towards the right direction.
Try using the name of the file, iterating through and checking if the file exists:
[[NSFileManager defaultManager] fileExistsAtPath:imagePath]
When it returns NO then you know there are no more files to add.