я делаю скриншот своего представления и сохраняю его в каталоге документов. Но мне нужно отобразить сохраненное изображение в приложении галереи iphone. Я не знаю, как передать изображения в галерею. помогите мне в этом. спасибо в рекламе..
- (IBAction)Screenshot:(id)sender {
CGSize targetImageSize = CGSizeMake(500, 500);
// Check for retina image rendering option
if (NULL != UIGraphicsBeginImageContextWithOptions) UIGraphicsBeginImageContextWithOptions(targetImageSize, NO, 0);
else UIGraphicsBeginImageContext(targetImageSize);
CGContextRef context = UIGraphicsGetCurrentContext();
// The view to be rendered
[[image layer] renderInContext:context];
// Get the rendered image
UIImage *original_image = UIGraphicsGetImageFromCurrentImageContext();
NSLog(@"%@",original_image);
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
// Get documents folder
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"/screenshots"];
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error];
//Create folder
// NSString *documentsDirPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *pngFilePath = [NSString stringWithFormat:@"%@/myPngFile.png",dataPath];
[UIImagePNGRepresentation(original_image) writeToFile:pngFilePath atomically:YES];
//[_image1 setImage:original_image];
UIGraphicsEndImageContext();
}