如何在目标c中将PFFILE设置为本地UIImage

时间:2015-08-20 09:40:01

标签: ios objective-c parse-platform uiimage pfimageview

如何设置本地UIImage to PFFILE`

我没有从解析数据库获得图像我使用了uiimagepickercontroller

我已尝试使用此代码,但未在PFImageView

中设置图片
UIImage *img=[UIImage imageNamed:@"Group_icon.png"];
PFFile *file = [PFFile fileWithName:@"Image.jpg"  data:UIImagePNGRepresentation(img)];
[imageUser setFile:file];
[imageUser loadInBackground];

请帮帮我

1 个答案:

答案 0 :(得分:0)

我遇到过同样的问题。在将PFImageView保存到服务器并获取之前,不能在PFImageView中使用PFFile。可能与缓存如何工作以及使用url作为关键。简单的解决方案是保存它,然后获取它并在imageview上设置它,但它很慢。更好的解决方案是保持UIImage,可能在NSCache或其他东西,并使用它直到它被保存到服务器。