以下のようにデバイス画面の互換性を確認できます。
//Device Compatibility
#define g_IS_IPHONE ( [[[UIDevice currentDevice] model] isEqualToString:@"iPhone"] )
#define g_IS_IPOD ( [[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"] )
#define g_IS_IPAD ( [[[UIDevice currentDevice] model] isEqualToString:@"iPad"] )
#define g_IS_IPHONE_5_SCREEN [[UIScreen mainScreen] bounds].size.height >= 568.0f && [[UIScreen mainScreen] bounds].size.height < 1024.0f
#define g_IS_IPHONE_4_SCREEN [[UIScreen mainScreen] bounds].size.height >= 480.0f && [[UIScreen mainScreen] bounds].size.height < 568.0f
if(g_IS_IPHONE_5_SCREEN)
{
if(g_IS_IPHONE)
NSLog(@"Hey, this is an iPhone 5 screen!");
else if(g_IS_IPOD)
NSLog(@"Hey, this is an iPod 5 screen!");
else
NSLog(@"Hey, this is a simulator screen with iPhone 5 screen height!");
}
else if(g_IS_IPHONE_4_SCREEN)
{
if(g_IS_IPHONE)
NSLog(@"Hey, this is a lower iPhone screen than 5!");
else if(g_IS_IPOD)
NSLog(@"Hey, this is a lower iPod screen than 5!");
else
NSLog(@"Hey, this is a lower simulator screen than 5!");
}
else if(g_IS_IPAD){
NSLog(@"Hey, this is an iPad screen!");
}
else{
NSLog(@"Hey, this is an ipad simulator screen!");
}
乾杯!