图片保存到本地相册

将图片保存到本地的相册中:

 

//保存
-(void)SaveAction{
    //保存到本地相册
    UIImageView *imgVCSave=[[UIImageView alloc]init];
    [imgVCSave setImageWithURL:[NSURL URLWithString:[_array_picURL objectAtIndex:_select_row]]];
    UIImageWriteToSavedPhotosAlbum(imgVCSave.image, self, @selector(imageSaveToPhoto:didFinishSavingWithError:contextInfo:), nil);
}


- (void)imageSaveToPhoto:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    NSString *message;
    if (!error) {
        message = @"成功保存到相册";
         [SVProgressHUD showSuccessWithStatus:message];
    }else
    {
        message = [error description];
    }
    NSLog(@"message is %@",message);
   
}

 

 

看一下官方文档:

image

The image to write to the Camera Roll album.

completionTarget

Optionally, the object whose selector should be called after the image has been written to the Camera Roll album.

completionSelector

The method selector, of the completionTarget object, to call. This optional method should conform to the following signature:

- (void)               image: (UIImage *) image
    didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo;
contextInfo

An optional pointer to any context-specific data that you want passed to the completion selector.

Availability iOS (2.0 and later)

你可能感兴趣的:(图片)