#define IS_ iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
用的时候直接
if (IS_iPhone5) {
}
2、xcode4.5不再支持armv6即:iOS4.3.3以下的系统.
不被支持的硬件设备包括:iPod 2nd gen, iPhone 3G 或更老的iPhone
例如打包时的错误提示就是:
warning: iOS deployment targets lower than 4.3 are not supported (current IPHONEOS_DEPLOYMENT_TARGET = "4.0", ARCHS = "armv7").(null): iPhone/iPod Touch: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv6 (-19033)
3、关于xib自适应的问题
默认的话,如果你的界面上包含scrollview/TableView的话,这个界面是不用改的,因为中间部分会自动拉伸。
如果不包含这两个全屏的控件的话,要再添加一个专门针对iPhone5的xib。新建一个xib文件,将里面view的size设置成Retina 4 Full Screen
4、iPhone5资源的加载
icon.png 320x480
icon@2x.png 640x960
icon-568h@2x.png 640x1136
真机(iPhone4)和模拟器(iPhone/iPhone Retina 3,5-inch/iPhone Retina 4-inch)测试,视图可以正常加载。