First, I selected the images from the photo library to the ALAsset library, after which I saved the images in the document directory from the ALAsset library path.
I use this code to store images in the document catalog from the ALAsset library .... Its working fine ... Now I want to display all the images that are stored in the document catalog as a table. How can i do this??? can someone help me?
Code for importing images from ALAsset to the NSdocument directory
for (int j=0; j<[assetArray count]; j++) {
ALAssetRepresentation *representation = [[assetArray objectAtIndex:j] defaultRepresentation];
NSString* filename = [documentPath stringByAppendingPathComponent:[representation filename]];
[[NSFileManager defaultManager] createFileAtPath:filename contents:nil attributes:nil];
NSOutputStream *outPutStream = [NSOutputStream outputStreamToFileAtPath:filename append:YES];
[outPutStream open];
long long offset = 0;
long long bytesRead = 0;
NSError *error;
uint8_t * buffer = malloc(131072);
while (offset<[representation size] && [outPutStream hasSpaceAvailable]) {
bytesRead = [representation getBytes:buffer fromOffset:offset length:131072 error:&error];
[outPutStream write:buffer maxLength:bytesRead];
offset = offset+bytesRead;
}
[outPutStream close];
free(buffer);
}
After that, I got the contents of the directory using this code:
NSFileManager *manager = [NSFileManager defaultManager];
fileList = [manager directoryContentsAtPath:newDir];
It also works ... but now that I want to display images from the document catalog. He does not show anything ....
setImage.image=[UIImage imageNamed:[filePathsArray objectAtIndex:0]];
- , ?????
- : * ALAsset ?