I am facing one problem. I have a directory named as Album under my Supporting Files group. In this directory I have some images. In my image editing app I want to save my edited images in my album directory. I tried to save the image in my album directory by using the following code
NSString *bundleRoot = [[NSBundle mainBundle] bundlePath];
NSString *albumPath = [bundleRoot stringByAppendingString:@"/Album"];
NSString *savedImagePath = [bundleRoot stringByAppendingPathComponent: @"newImage11.jpeg" ]; UIGraphicsBeginImageContext(drawImage.image.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[drawImage.layer renderInContext:ctx];
UIImage *editedImage = UIGraphicsGetImageFromCurrentImageContext();
NSData *editedImageData = UIImageJPEGRepresentation(editedImage, 1.0); UIGraphicsEndImageContext();
[editedImageData writeToFile:savedImagePath atomically:YES];
Here drawImage is the IBOutlet of UIImageView which holds the image.This code saved a file newImage11.jpeg in my album directory which has a size also. but when I retrieve the image from album directory it gives me a blank image. I used the following code to retrieve the image
NSString *img = [onlyJPGs objectAtIndex:currentIndex+numberToAdd];
UIImage *tempImage = [UIImage imageNamed:img];
imageButton.tag = img;
[imageButton setImage:tempImage forState:UIControlStateNormal];
[imageButton addTarget:nil action:@selector(goToEdit:) forControlEvents:UIControlEventTouchUpInside];
currentIndex+=numberToAdd;
onlyJPGs is an array which holdes the name of all images contained in the Album directory. I am sure that my app is saving the image in Album directory because when I list the contents of Album directory in ImageEditing.app by using terminal it shows me the newImage11.jpeg file. Any kind of help would be appreciable.