Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Parse platform 将PFImageView的image属性设置为本地映像,然后使用PFFile更新解析数据库_Parse Platform_Pffile - Fatal编程技术网

Parse platform 将PFImageView的image属性设置为本地映像,然后使用PFFile更新解析数据库

Parse platform 将PFImageView的image属性设置为本地映像,然后使用PFFile更新解析数据库,parse-platform,pffile,Parse Platform,Pffile,PFImageView及其.file属性和相应的-loadInBackground方法非常有用。我不知道如何“走另一条路”,即从新图像获取PFFile引用: RA_MyAccount.h(摘录) RA_MyAccount.m(摘录) 我已经用表示了我遇到问题的地方。所以,我有一个答案,但我不相信这是最聪明的方法。当我对图像编码一无所知时,我还担心会开始使用像uiimagejpegresentation(它甚至是函数吗?) file = [PFFile fileWithData:UIImageJP

PFImageView
及其
.file
属性和相应的
-loadInBackground
方法非常有用。我不知道如何“走另一条路”,即从新图像获取
PFFile
引用:

RA_MyAccount.h(摘录)

RA_MyAccount.m(摘录)


我已经用
表示了我遇到问题的地方。

所以,我有一个答案,但我不相信这是最聪明的方法。当我对图像编码一无所知时,我还担心会开始使用像
uiimagejpegresentation
(它甚至是函数吗?)

file = [PFFile fileWithData:UIImageJPEGRepresentation(self.profilePic.image, 0.8f)];

只要你对图像质量下降没什么意见(如果是照片的话应该没问题),那么你就要按照下面的方法来做。0.8表示80%的压缩质量

file = [PFFile fileWithData:UIImageJPEGRepresentation(self.profilePic.image, 0.8f)];
如果你不能失去质量,那就按照下面的方法去做

file = [PFFile fileWithData:UIImagePNGRepresentation(self.profilePic.image)];
有关各种格式的更详细比较,请参见

file = [PFFile fileWithData:UIImageJPEGRepresentation(self.profilePic.image, 0.8f)];
file = [PFFile fileWithData:UIImagePNGRepresentation(self.profilePic.image)];