1. [[UIScreen mainScreen] applicationFrame].size.width;
give measurements in "points", not "pixels". For everything else, pixels=points, but for the iPhone4, each point has 4 pixels. Normal images are scaled in the iPhone4, so each pixel in the image is mapped onto a point. This means that the iPhone4 can run iPhone apps without a noticeable change.
iPhone是以“点”来计量尺寸,而不是像素。一般情况,一个点 = 一个像素,但是iPhone4一个点等于4个像素,所以用[[UIScreen mainScreen] applicationFrame].size.width取出来的长度和宽度还是320*480.这也意味着iPhone4跑以前的程序基本不用做修改。
The "apple" way to add "hi-res" images that take advantage of the iPhone's greater resolution is to replace ".png" with "@2x.png" in the image file name, and double the pixel density (effectively, just the width&height) in the image. Importantly, don't change the way the image is referred to in your code.?So if you have "img.png" in your code, iPhone4 will load the "img@2x.png" image if it is available.
但是之前有涉及到图片的,一个像素被拉伸到了4个像素,图片质量会变低。解决方法是替换图片的后缀为
The problem with this is that, if you are trying to develop a Universal app, and include separate images for all the different possible screen resolutions/pixel densities, your app will get bloated pretty quick.
这样解决问题的缺点是,当你有很多图片的时候,你的程序包会有增加得很大块。
A common solution to this problem is to pull all the required images on the net. This will make your binary nice and small. On the negative side, this will eat into your user's internet quota, and it will
对于此问题一般的解决方法是将图片放到网上,运行程序时获取。当时这样也会涉及到用户上网和流量的问题。
http://blog.sina.com.cn/s/blog_4cdc44df0100phfr.html
2.在ios工程中的代码中,只需要使用不带@2x的图片名。
3.关于UIImage.size属性
4.关于iPhone默认启动图片Default.png
标准: <ImageName><device_modifier>.<filename_extension>
高分辨率: <ImageName>@2x<device_modifier>.<filename_extension>
device_modifier:可选, ~ipad or ~iphone.
UIImage的imageNamed:, imageWithContentsOfFile:, and initWithContentsOfFile: 这3个方法有自动选择高清图片的效果
plist中的CFBundleIconFiles 属性
icon尺寸
iphone
搜索结果中的额图标
iPad
72 x 72 pixels
搜索结果中的额图标
50 x 50 pixels
启动画面
iphone
320 x 480 pixels
640 x 960 pixels (high resolution)
ipad
768 x 1004 pixels
···
···