ios - 如何快速将字符串描述保存到图像文档中?
问题描述
出于澄清原因,我正在尝试为图像文档编写一些描述。是否可以像在 Android 中那样为文档文件编写描述?如果有怎么办?
开发人员说明:对于那些不知道的人,保存到照片应用程序的选项非常有限。(您不能命名您的文件,将扩展名从 Jpeg 更改为 png,创建子目录等)
下面是将图像保存到文档目录的代码
//将图像保存在文档目录中:
let fileManager = FileManager.default
let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] + "/swiper.jpg"
let imageData = UIImageJPEGRepresentation(#imageLiteral(resourceName: "swiper"), 0.5)
fileManager.createFile(atPath: path, contents: imageData, attributes: nil)
Github 代码链接:
解决方案
推荐阅读
- sql - SQL Query 在我使用 GetDate() 时不起作用,但在我不使用时起作用
- matlab - 将int32值转换为固定pt,但固定pt数据类型存储为char
- windows - 如何将 regcap 用于 64 位 DLL 文件
- node.js - 如何从 Node.js 服务器(从端口 55000)向同一台计算机上运行的其他端口(可能是 8883)发送消息,例如“Hello I am Some Packet”?
- c++ - QGLViewer 最小示例失败。正确的依赖设置未知
- r - 如何对两个表进行特定的复杂绑定
- python - 静音命令失败并显示“AttributeError:'NoneType' 对象没有属性 'id'”
- java - 在 java/spring rest 中监控 rest API 调用
- r - clang-7:错误:链接器命令失败,macOS Big Sur 的退出代码为 1
- python - python切片中的“a[:,1]”是什么意思