开发者

UIImageWriteToSavedPhotosAlbum creates black thumbnail in camera roll

I am saving image in the camera roll using UIImageWriteToSavedPhotosAlbum but always get an black thumbnail even if the 开发者_运维问答picture is correct.

Do you have pointers to address this?

Thanks in advance for your help.

Regards,


I had the same problem. Drawing the image within a UIGraphicsImageContext solves the issue:



  CGRect rect = CGRectMake(0,0,100,100);
  UIImage *image = ((put here your image));

  UIGraphicsBeginImageContext(rect.size);
  [image drawInRect:rect];
  UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();  

  UIImageWriteToSavedPhotosAlbum(
      result, self, @selector(image:didFinishSavingWithError:contextInfo:),nil);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜