我已经开发了一个针对3.5英寸屏幕的应用程序,现在我为4英寸屏幕制作了新的Storyboard,并按照以下方式在appdelegate中切换Storyboard。 我记录了屏幕高度,它给出了480.00000,请看:
NSLog(@"Checking Screen Size");
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)
{
NSLog(@"On iPhone");
CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
if (iOSDeviceScreenSize.height == 480)
{ (diagonally measured)
NSLog(@"iPhone 4: %f", iOSDeviceScreenSize.height);
}
if (iOSDeviceScreenSize.height == 568)
{
NSLog(@"iPhone 5: %f", iOSDeviceScreenSize.height);
}
当我使用 iPhone 5 时,NSLog 显示 480.0000。