使图像适应视网膜显示

使图像适应视网膜显示

本文介绍了iPhone - 使图像适应视网膜显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,关于更新我的应用程序的视网膜显示的iPhone 4的图形。



我保持每个视图的分辨率为480 x 320点。 p>

所以我想知道:假设我有一个100 x 50 UIImageView。
对于我的实际图像,我将加载为200 x 100像素@ 163 ppi或100 x 50像素@ 326 ppi?在轻量方面它是同样的事情吗?



Lorenzo

解决方案

1)如上所述,将UIImageView定义为100 x 50像素。



2)有一个图像文件是100x50像素的MyImage,第二个图像文件是200x100像素,并命名为MyImage @ 2x。



在您的代码中,请参阅图像文件MyImage。



iOS将自动选择正确的图像。在没有视网膜显示器(即,iPhone 3GS)的旧设备上,将使用MyImage文件。在有视网膜显示器的新设备上,将使用@ 2x版本。


I have a question about updating my app's graphics for the retina display of the iPhone 4.

I am keeping each view's resolution to 480 x 320 Points.

So I was wondering: suppose I have a 100 x 50 UIImageView.It's better for my actual image I am going to load to be 200 x 100 pixels @ 163 ppi or 100 x 50 pixels @ 326 ppi? Is it the same thing in terms of 'lightness'? which is the preferred way?

Thanks, you're awesome

Lorenzo

解决方案

1) Define your UIImageView to be 100 x 50 pixels as you describe it above.

2) Have one image file that is 100x50 pixels "MyImage", and a second image file that is 200x100 pixels, and name it "MyImage@2x".

3) In your code, refer to the image file "MyImage".

iOS will automatically select the correct image. On older devices without the retina display (i.e., iPhone 3GS), the "MyImage" file will be used. On newer devices that have the retina display, the "@2x" version will be used.

这篇关于iPhone - 使图像适应视网膜显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 11:30