iPhone分辨率

精贴 置顶
1441 0

1. [[UIScreen mainScreen] applicationFrame].size.width; 
    [[UIScreen mainScreen] applicationFrame].size.height;


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个像素,图片质量会变低。解决方法是替换图片的后缀为 "@2x.png",代码中的引用不用做任何改变,系统会根据硬件自动去读入相关文件。


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 really annoy users who don't have wifi--especially if your app has no other reason to use the 'net (and you don't say your app needs the 'net in your app store description).


对于此问题一般的解决方法是将图片放到网上,运行程序时获取。当时这样也会涉及到用户上网和流量的问题。


http://blog.sina.com.cn/s/blog_4cdc44df0100phfr.html

 

2.在ios工程中的代码中,只需要使用不带@2x的图片名。

   使用iphone retina模拟器时,如果工程中把640x960像素(简称640)的图片写成了不带@2x,则模拟器会认为这是一张320x480像素(简称320)的图片,采用1对1(1个像素对应1个点)的策略,,只显示其左上320x480像素即1/4的部分.

   使用iphone模拟器时,如果使用了640的@2x图片,同样会正常显示,因为模拟器会把图片中的4个像素对应为一个点; 如果把320的图片写成了@2x,页面中的背景图片会完全显示到屏幕左上部分,因为此时按4对1,图片只够显示在屏幕左上。不过启动图片仍然全屏,但会变的模糊,。

   只有iphone4会区分识别@2x, iphone3不会识别@2x,但640x960的Default.png能正常缩放显示。其它的640x960的图片只能显示1/4。

   iPhone4支持的屏也叫视网膜(retina)屏,就是肉眼看不到像素点。

   可能内存不足的时候,如果已有很多retina的程序跑于后台,会加载normal的,以节约内存。

   在升级到ios4的iPhone3上,优先使用不带@2x的图片。

3.关于UIImage.size属性

  In iOS 3.x and earlier, this value always reflects the dimensions of the image measured in pixels.

  In iOS 4.0 and later, this value reflects the logical size of the image and is measured in points.

 

4.关于iPhone默认启动图片Default.png

   可以提供为屏幕尺寸,也可以提供为屏幕尺寸减去状态栏尺寸.

   对于iphone, Default.png可以为320x480或者320x460, Default@2x.png iPhone4启动图片640x960或者640x920.

   http://news.wangmeng.cn/detailNews/2984-iphone-start-page-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
    57 x 57 pixels
    114 x 114 pixels (@2x)
搜索结果中的额图标
    29 x 29 pixels
    58 x 58 pixels (@2x)

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

  • 没有任何评论
今日天气 ···

···

···

···

热门排行
CSS cursor鼠标样式一览表 2012-06-25
.NET后台写JS代码 2011-11-03
网站地址多出jdfwkey的问题解析及... 2010-08-25
数据库xxx的日志已满,请备份该数... 2013-07-19
百度、google、Yahoo网站地图制作... 2011-01-30
<a>标签的伪类书写顺序问题... 2010-09-04
什么是长尾关键词? 2010-09-24
CEO名言 2010-08-31
Mysql 主从数据库同步 2010-09-12
用ASP实现网页BBS 2010-11-01
博主推荐
本个人博客微信公众平台上线啦~~... 2013-10-13
饼哥网络互联上线啦~~要买域名空... 2013-09-20
网站title标题如何正确修改不会被... 2013-08-26
饼哥通讯录系统上线啦,欢迎大家... 2013-08-24
ASP .NET MYSQL 的简单分页 并不... 2013-08-19
网站有弹窗广告这样的站点,百度... 2013-08-17
做淘宝SEO优化需要注意的8大问题 2013-08-17
淘宝网怎么做SEO优化 2013-08-17
站长们要学习的“苍井空精神” 2013-08-17
苹果公司今日发布了iOS 7第五个开... 2013-08-07
随便看看
IBM JDK一个诡异问题:java类名无... 2013-06-26
用Windows 7媒体中心 浏览照片更... 2011-01-20
需要在每个网页标题加网站名称吗... 2010-09-29
软件革命第二步:转向云计算 2013-09-29
几种方法教你如何将windows服务删... 2011-01-22
win7系统怎么用笔记本做wifi热点... 2013-07-29
常用的ASPActiveX 组件 2010-10-22
可以执行系统命令的ASP原码放送 2010-10-26
ASP.NET中 Repeater嵌套应用 2013-07-01
.Net中判断日期时间输入是否合法... 2013-08-22
RSS新闻
传媒新闻
CSDN
八卦新闻
女性新闻
台湾新闻
互联网
军事-新浪博客
IT-新浪博客
汽车新闻
游戏新闻
国际新闻
国内新闻
体育新闻
我的微博
北京 上海 杭州 深圳 广州 成都