尝试在iOS中使用自定义名称将图像保存到相册 [英] Trying to save image to Photo album with custom name in iOS

查看:1285
本文介绍了尝试在iOS中使用自定义名称将图像保存到相册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iOS应用程序,我将图像保存到我的照片文件夹到我的iPad。但是,我想要做的是使用自定义名称存储图像(例如,使用实际捕获图像时的日期和时间戳),以便将来更容易检索它。我目前用于存储图像的代码如下:

I have an iOS application where I am saving an image to my photos folder to my iPad. However, what I would like to do is store the image with a custom name (e.g. using the date and time stamp for when the image was actually captured), so that it would be easier for it to be retrieved in the future. My code at the moment for storing my images is as follows:

- (IBAction)imageCapture:(id)sender {

    UIImage *myImage = [_imageView currentImage];
    UIImageWriteToSavedPhotosAlbum(myImage, nil, nil, nil);

}

我可以存储我的图像,但我该怎么做在存储之前命名图像(例如082620131100am.png?

I am able to store my image, but how do I name the image prior to storing it (e.g. "082620131100am.png"?

提前感谢所有回复的人

推荐答案

由于您无法覆盖用户照片库中的任何图像/视频,因此您无法为该文件指定特定的文件名。

Since you cannot override any image/video in the user's photo library, you will not be able to give the the file a specific filename.

如果您使用以下方法,则可以向图像添加一些元数据: writeImageDataToSavedPhotosAlbum:metadata:completionBlock: ,但你会无法设置文件名。

You can add some metadata to your image if you use the method: writeImageDataToSavedPhotosAlbum:metadata:completionBlock:, but you will not be able to set the filename.

这篇关于尝试在iOS中使用自定义名称将图像保存到相册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆