Trying to save image to Photo album with custom name in iOS(尝试在 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 中使用自定义名称将图像保存到相册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:尝试在 iOS 中使用自定义名称将图像保存到相册
基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
