4

将PFFile转换为UIImage的步骤是什么

我设法从解析为 PFFile 获取图像。但我无法向用户显示视图,因为它不是 UIImage。

有人可以指导我吗?

我不断得到

 error: [UIImageView setFile:]: unrecognized selector sent to instance 0x7ff2937a9bd0 on the console

每当我尝试从解析中获取图像文件并将其设置为 UIImage

这是将文件设置为 UIImageView 的代码

var initialThumbnail = UIImage(named: "AppIcon")
        cell.customImage.image = initialThumbnail
        if let picture = object?["image"] as? PFFile {
            cell.customImage.file = picture
            cell.customImage.loadInBackground()
        }

这是 customImage 插座的代码

@IBOutlet weak var customImage: PFImageView!

其他数据加载很好,但唯一的问题是文件数据。

4

1 回答 1

2

I am doubtful that the class of the ImageView is UIImageView and not PFImageView...

Select your imageView and go to identity inspector, it must be appearing like this...

Must be this currently...

Should be this...

Should be like this...

As it is PFImageView that understands the getter and setter methods for property 'file'.

于 2015-05-19T05:47:22.567 回答