如何从UIImage获取文件路径? [英] How can I get the file path from a UIImage?
本文介绍了如何从UIImage获取文件路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常情况相反,您使用路径显示图像。我想知道如果你已经拥有图像,是否可以获得路径。
Usually it's the other way around, you use the path to display the image. I was wondering if you can get the path if you already have the image.
推荐答案
如果你已经拥有图片,即已添加文件到你的资源,你可以使用它来获取文件路径;
if you already have the image i.e. have added the file to your resources, you can use this to get the file path;
NSString *string = [[NSBundle mainBundle] pathForResource:@"IMAGE_FILE_NAME" ofType:@"jpg"]; // or ofType:@"png", etc.
这篇关于如何从UIImage获取文件路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文