简体   繁体   English

将UIImage作为PNG保存到iPhone上的相册

[英]Saving UIImage as PNG to photo album on iPhone

I am merging some png files to a uiimage and I followed this thread ( UIImageWriteToSavedPhotosAlbum save as PNG with transparency? ) 我正在将一些png文件合并到一个uiimage中,我跟着这个帖子( UIImageWriteToSavedPhotosAlbum保存为PNG,透明度?

and tried to save the result as a png file by replacing this code with my image: [self composeImageWithWidth:100 andHeight:100).. 并尝试通过将此代码替换为我的图像将结果保存为png文件:[self composeImageWithWidth:100 andHeight:100)..

When I test this using simulator, I go to the folder in application support and find the png there. 当我使用模拟器测试时,我转到应用程序支持中的文件夹并在那里找到png。 However when I test this on a real device, I cannot find the png file in my photo album. 但是当我在真实设备上测试时,我在相册中找不到png文件。

What could be going wrong? 怎么可能出错? Perhaps the paths of photo album? 也许是相册的路径?

Thanks for the answers 谢谢你的回答

You can use this function: 你可以使用这个功能:

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

You only need completionTarget, completionSelector and contextInfo if you want to be notified when the image is done saving, otherwise you can pass in nil. 如果要在保存图像时收到通知,则只需要completionTarget,completionSelector和contextInfo,否则可以传入nil。

More info here 更多信息在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM