简体   繁体   English

ios:根据屏幕分辨率调整图像大小

[英]ios: image resize as per screen resolution

I am displaying image thumbnails from urls(which are in json file) into custom cells of a tableview. 我正在将图像缩略图从urls(位于json文件中)显示到tableview的自定义单元格中。

The images loaded from url are not showing up properly- they are of a resolution much higher than need and some are of much lower resolution. 从url加载的图像无法正确显示-它们的分辨率比需要的要高得多,而某些分辨率则要低得多。

How do I manipulate these images so that they are scaled properly as per each screen(retina as well as normal) in iphone? 如何处理这些图像,以便在iPhone中按每个屏幕(视网膜和正常屏幕)正确缩放它们?

How do I scale and resize the thumbnail images from url? 如何缩放和调整URL缩略图的大小?

Unless you care about other issues like memory or disk usage (for some caching) for the images, you don't have to resize them. 除非您关心其他问题,例如图像的内存或磁盘使用情况(用于某些缓存),否则不必调整它们的大小。

You can use UIViewContentModeScaleAspectFit as contentMode for an UIImageView and just set an image for the image view. 您可以将UIViewContentModeScaleAspectFit用作UIImageView contentMode ,而只需为图像视图设置图像。 It would be sufficient for you. 对您来说就足够了。

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

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