简体   繁体   English

iOS - 图像大小与ImageView大小

[英]iOS - Size of Image vs. Size of ImageView

just want to see if I'm on the right track here is understanding the performance trade-offs of placing various image sizes into image views. 只是想看看我是否在正确的轨道上这里是理解将各种图像尺寸放入图像视图的性能权衡。

If I have a large image, will the image load faster if I place it in a correspondingly large imageView versus placing it in a smaller imageView? 如果我有一个大图像,如果我把它放在一个相应大的imageView而不是放在一个较小的imageView中,图像加载会更快吗?

No, the loading time depends on the file, and if the image is large, and its file Size is large, it will load slower than a small images on the same image View. 不,加载时间取决于文件,如果图像很大,并且文件大小很大,则加载速度会慢于同一图像视图上的小图像。 To make it clear, image view doesn't affect loading performance, image size (File size) does affect performance. 为清楚起见,图像视图不会影响加载性能,图像大小(文件大小)确实会影响性能。

Answering you r question first, size of image is not directly proportional to imageview ie regardless of your imageview size, you image will take time based on the size of image. 首先回答你的问题,图像的大小与图像视图不成正比,即无论你的图像视图大小如何,你的图像都需要时间根据图像的大小。

Now, if you have a task in which you need to show user images & on click you need to share that image, you need to maintain 2 copies for showing take resized copy & while sharing pick image from original position. 现在,如果您有一个需要显示用户图像的任务,那么您需要共享该图像,您需要保留2份副本以显示调整大小的副本并同时从原始位置共享拾取图像。 In this way, your loading will be fast & while sharing you will be able to share original image itself. 通过这种方式,您的加载速度很快,在共享时您可以自己共享原始图像。

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

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