Retina/non-retina images in UIImageView

一笑奈何 提交于 2019-12-10 02:07:58

问题


I have a 300 x 300 sized UIImageView in my app which is displaying my images very nicely. My images are all 600 x 600 or larger and UIImageView simply resizes them for me.

My question is this: as these images are essentially all retina images anyway (i.e. double the required pixel size) is there any point in making a retina and a non-retina version of the same image? Won't this just make my app bigger because of the extra image files?

What's wrong with just letting the device downscale the images? I'm sure there's a very good answer so I'd like to know what it is!

Thanks for your advice.


回答1:


For our apps we use a combination of the @2x images and doing what you've suggested, Scaling. We use the @2x images for bar buttons, icons, etc. But for UIImageViews we often just use the Scaling.

Here is an article that suggests both: http://mobile.tutsplus.com/tutorials/iphone/preparing-your-iphone-app-for-higher-resolutions/

Ignore the part about the iPad not supporting @2x (that is old information) but the article is still good.

There can be a performance hit for doing this, but for most apps I'd say this is negligible. The savings in file size sometimes make scaling the only option.




回答2:


Scaling the images is an unnecessary overhead. Just provide two versions of it.



来源:https://stackoverflow.com/questions/4649908/retina-non-retina-images-in-uiimageview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!