【发布时间】:2012-09-18 06:27:02
【问题描述】:
我正在尝试向现有 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];
}
}
【问题讨论】:
-
同上@RichardAltenburg-Brainchild - 生活的现实是有时您需要快速修复。迁移到约束布局系统是长期正确的方法,但如果您有很多视图,则需要一些时间。
-
使用我在此处发布的通用应用 iPhone 3Gs/4s/5 和 iPad 的优化代码stackoverflow.com/questions/12395200/…