屏幕模式肖像模式Portrait风景模式Landscape1. [UIScreen mainScreen].applicationFrame 是{(0,20),(320,460)}[UIScreen mainScreen].bounds 是{(0,0),(320,480)}[[UIApplication sharedApplication] statusBarFrame]; 是{(0,0),(320,20)}CGSize size [UIScreen mainScreen].currentMode.size;//以像素为单位的尺寸但如果 [[UIApplication sharedApplication] setStatusBarHidden:YES]; statusBarFrame就是0了。give measurements in points, not pixels. For everything else, pixelspoints, 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 iPhones greater resolution is to replace .png with 2x.png in the image file name, and double the pixel density (effectively, just the widthheight) in the image. Importantly, dont change the way the image is referred to in your code. So if you have img.png in your code, iPhone4 will load the img2x.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 users internet quota, and it will really annoy users who dont have wifi--especially if your app has no other reason to use the net (and you dont say your app needs the net in your app store description).对于此问题一般的解决方法是将图片放到网上运行程序时获取。当时这样也会涉及到用户上网和流量的问题。http://blog.sina.com.cn/s/blog_4cdc44df0100phfr.html2.在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, Default2x.png iPhone4启动图片640x960或者640x920.http://news.wangmeng.cn/detailNews/2984-iphone-start-page-default-png在工程中加入Default-568h2x.png的640x1136的图片就可以适应iPhone5了.标准: ImageNamedevice_modifier.filename_extension高分辨率: ImageName2xdevice_modifier.filename_extensiondevice_modifier:可选, ~ipad or ~iphone.UIImage的imageNamed:, imageWithContentsOfFile:, and initWithContentsOfFile: 这3个方法有自动选择高清图片的效果plist中的CFBundleIconFiles 属性icon尺寸iphone57 x 57 pixels114 x 114 pixels (2x)搜索结果中的额图标29 x 29 pixels58 x 58 pixels (2x)iPad72 x 72 pixels搜索结果中的额图标50 x 50 pixels启动画面iphone320 x 480 pixels640 x 960 pixels (high resolution)ipad768 x 1004 pixels可能Icon.pngIcon2x.png也要大写i。纵向状态下状态栏20高导航栏44高选项卡或工具栏48高键盘216高UISwitch94x28分段控件44高输入框30高。类方法用来隐藏间例。关于app同时支持iphone/ipad的问题http://www.cocoachina.com/bbs/read.php?tid-44651.htmlhttp://www.cocoachina.com/bbs/read.php?tid-41245-keyword-xib%7C%CE%C4%BC%FE.htmlhttp://www.cocoachina.com/bbs/read.php?tid-31022.htmliPhone与iPad开发的区别iPhone与iPad开发的区别_apple development iphone development-CSDN博客Sizes of iPhone UI Elementshttp://www.idev101.com/code/User_Interface/sizes.html
阅读完成 · 觉得有帮助?