简体   繁体   English

UIImagePickerController缓慢显示图像

[英]UIImagePickerController slow to show image

I have an application that is based on UIImagePickerController, everything is working just fine except, When i try to open Panorama images (<220 degree POV) the imagepicker controller is taking a lot of time to open, and display the image. 我有一个基于UIImagePickerController的应用程序,一切正常,但是,当我尝试打开全景图像(<220度POV)时,imagepicker控制器需要花费大量时间打开,并显示图像。 I know how panorama image can be quite huge as for their resolution, and that i can scale them once they load up depending on their ratio. 我知道全景图像的分辨率可能非常大,而且我可以根据它们的比例加载它们。

But the problem is that due to its initial size when loading the image from the Gallery, its taking a lot of time, How can i optimize this? 但问题是,由于从图库加载图像时的初始尺寸,它需要花费大量时间,我该如何优化呢?

You need to store all the images and reduce the size, then populate it back 您需要存储所有图像并缩小尺寸,然后将其填充

NSData *imageData = UIImageJPEGRepresentation(your_image, your_reduced_scale (0.0 -> 1.0) );
UIImage *img = [UIImage imageWithData:imageData];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM