iOS 10保存图片到本地相册

UIImage *postersImage;

#pragma mark 保存海报

- (IBAction)SavePosters:(id)sender {

//海报赋值

[self loadImageFinished:postersImage];

}

#pragma mark 保存海报

- (void)loadImageFinished:(UIImage *)image

{

UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), (__bridge void *)self);

}

#pragma mark 保存海报

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

{

NSString *msg = nil ;

if(error != NULL){

msg = @"保存图片失败" ;

}else{

msg = @"已保存到手机相册" ;

}

[ScanAlertMBTool addContainerView:self.view andMBProgressHUDView:[[MBProgressHUD alloc]init] andMessage:msg andDelay:2];

}

你可能感兴趣的:(iOS 10保存图片到本地相册)