原文:http://blog.csdn.net/linzhiji/article/details/8000048
今天apple发布ios6, 也许很快就能见到iphone 5的手机。不过现在只能从模拟器上来测试程序。
如何开发或者适配iphone5 4英寸的屏幕
1.安装xcode 4.5,选择Retina(4-inch)启动画面,
2. 添加启动图片, Default-568h@2x.png, 分辨率640 * 1136 pixels, 如果不增加会如下:
3.在编码时,尽量不要写死480,根据屏当前屏幕([UIScreen mainScreen].bounds)选择size能在分辨率改变时省去不少麻烦。
stackoverflow上代码,如何判断iphone 5
- #define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
如果要兼任ipad
- <p class="p1">#define IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )span class="s1">568</span> ) DBL_EPSILON )p>>#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @span class="s2">"iPhone"> ] )>#define IS_IPHONE_SIMULATOR ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @>"iPhone Simulator">#define IS_IPOD ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @>"iPod touch">#define IS_IPHONE_5 ( ((IS_IPHONE) || (IS_IPHONE_SIMULATOR)) && IS_WIDESCREEN )>