Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.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
Ios 如何将UIimage转换为NSData。?_Ios_Web Services_Uiimage_Nsdata - Fatal编程技术网

Ios 如何将UIimage转换为NSData。?

Ios 如何将UIimage转换为NSData。?,ios,web-services,uiimage,nsdata,Ios,Web Services,Uiimage,Nsdata,我从WebService得到一个图像对象,我不知道图像的格式是什么。而不是如何将此图像对象更改为NSData。请帮忙。谢谢 NSData *imgData = UIImageJPEGRepresentation(yourImage, 1.0); 或 只有一句简单的话可以帮你 NSData *imageData = UIImagePNGRepresentation(yourImageView.image); 如果你不知道从webservice获取图像的格式,你就什么也做不了。你可以查看并参考它

我从WebService得到一个图像对象,我不知道图像的格式是什么。而不是如何将此图像对象更改为NSData。请帮忙。谢谢

NSData *imgData = UIImageJPEGRepresentation(yourImage, 1.0);


只有一句简单的话可以帮你

NSData *imageData = UIImagePNGRepresentation(yourImageView.image);

如果你不知道从webservice获取图像的格式,你就什么也做不了。你可以查看并参考它,它可能会对你有所帮助。
NSData *imageData = UIImagePNGRepresentation(yourImageView.image);