在ios中保存图片到照片库

来源:互联网 发布:郑州市软件开发公司 编辑:程序博客网 时间:2024/05/22 03:49

void UIImageWriteToSavedPhotosAlbum(UIImage *image,id completionTarget,SEL completionSelector, void *contextInfo);

image:要保存到照片库的图片对象,UIImage类型

completionTarget:当保存完成之后,回调方法所在的对象

completionSelector:回调方法

contextInfo:可选的参数,保存一个指向context数据的指针,它将传递给回调方法


回调方法可以这样定义:

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

{

     if(error == nil){

//show error message

     }else{

//save successfully

     }

}

原创粉丝点击