用UIImageWriteToSavedPhotosAlbum往照片库里面存图片时,经常发生缩略图能看到但原图消失的问题
用 UIImageWriteToSavedPhotosAlbum(imageSave, nil, nil, nil), imageSave是UIImage类型,这样就保存进去了。
而且注意图片不宜过大,以免程序崩溃
UIImage *Image = [UIImage imageNamed:@"2.png"];
UIImageWriteToSavedPhotosAlbum(Image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
NSString *msg = nil;
if(error != NULL)
{
msg = @"保存图片失败";
} else {
msg = @"保存图片成功";
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"保存图片结果提示" message:msg delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
}
浙公网安备 33010602011771号