查找加载到UIImage实例中的图像名称 [英] Finding image name loaded into UIImage instance

查看:32
本文介绍了查找加载到UIImage实例中的图像名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定加载到UIImage实例中的图像名称(通常是文件名?)是什么?在这种情况下,它们都是 initWithContentsOfFile:

How can I find out what the image name (usually file name?) loaded into a UIImage instance is? In this case, they were all initWithContentsOfFile:.

推荐答案

使用它加载,您不能。文件名仅用于将数据加载到内存中。之后,它就变得无关紧要了。

Once it's loaded using that, you can't. The file name is only used to load the data into memory. After that, it becomes irrelevant.

如果您需要维护文件名,则可能需要使用文件名创建一个类(如 NSString NSURL 以及图像数据(作为 NSImage NSData 对象)作为ivars。我不确定您的应用程序是什么,因此目前无法提供任何架构建议。

If you need to maintain the file name, then perhaps you need to make a class with the filename (as an NSString or NSURL, perhaps) and the image data (as an NSImage or NSData object) as ivars. I'm not sure what your application is, so I can't give you any architectural advice at this point.

这篇关于查找加载到UIImage实例中的图像名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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