首页 > 解决方案 > 从 UIImage 获取图像路径

问题描述

我有动态生成的uiimage代码:

for product in self.productObject {
                if product.code != nil{
                    self.imageView1.image = UIImage(contentsOfFile: documentsDir.appendingPathComponent("myfiles").path + "/" + product.code! + ".jpg")
                }
            }

我需要在按钮中获取当前显示图像的路径:

@IBAction func showImagesInPopup(_ sender: Any) {
        var path = self.imageView1.image.path
        self.performSegue(withIdentifier: "toProductDetail", sender: self)
    }

我怎样才能得到它并保存到“路径”?

标签: iosswiftnsdocumentdirectory

解决方案


推荐阅读