[英]How to save photo in a particular album in iOS
我正在使用此代码将图像保存到相册中,但是图像被保存在“相机胶卷”相册中。 我想将图像保存在WEAVE相册中。 我正在使用此代码:
CGRect screenRect=CGRectMake(0, 0, viewPlay.frame.size.width, viewPlay.frame.size.height);
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx=UIGraphicsGetCurrentContext();
[[UIColor whiteColor] set];
CGContextFillRect(ctx, screenRect);
[self->viewPlay.layer renderInContext:ctx];
UIImage *screenImage=UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
UIGraphicsEndImageContext();
这段代码对我来说很好用。 请给我任何建议,我在这里做了什么更改以将图像保存到WEAVE文件夹中。
您可以使用以下代码执行此操作:
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library saveImage:image toAlbum:@"Midhun" withCompletionBlock:^(NSError *error) {
if (error!=nil)
{
NSLog(@"Error: %@", [error description]);
}
}];
还请检查本教程: 自定义相册
有关ALAssetsLibrary的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.