可能重复:
如何检测 iPhone 5(宽屏设备)?
我正在尝试向现有 ios4 项目添加新视图以处理新的 iphone5 屏幕尺寸。
但是我这里没有要测试的iphone,我用来测试屏幕尺寸的代码不起作用,只是想知道是否有另一种检测设备类型的方法?
NSLog(@"%f", [ [ UIScreen mainScreen ] bounds ].size.height);
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
if([UIScreen mainScreen].bounds.size.height == 568.0)
{
//move to your iphone5 storyboard
[self changeView:splashScreenBIGV viewH:splashScreenH animLength:SCREEN_CHANGE_ANIM_LENGTH];
}
else{
//move to your iphone4s storyboard
[self changeView:splashScreenV viewH:splashScreenH animLength:SCREEN_CHANGE_ANIM_LENGTH];
}
}