The new iPad pro has different dimension and resolutions. If I check based on screen width would it be correct? I havent upgraded to Xcode 7.1 nor do I have the device so I can't check it yet. Will this check work?
if([UIScreen mainScreen].bounds.size.width>1024)
{
// iPad is an iPad Pro
}
You may use this
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define IS_IPAD_PRO_1366 (IS_IPAD && MAX(SCREEN_WIDTH,SCREEN_HEIGHT) == 1366.0)
#define IS_IPAD_PRO_1024 (IS_IPAD && MAX(SCREEN_WIDTH,SCREEN_HEIGHT) == 1024.0)
Then
if (IS_IPAD_PRO_1366) {
NSLog(@"It is ipad pro 1366");
}
+(BOOL) isIpad_1024
{
if ([UIScreen mainScreen].bounds.size.height == 1024) {
return YES;
}
return NO;
}
+(BOOL) isIpadPro_1366
{
if ([UIScreen mainScreen].bounds.size.height == 1366) {
return YES;
}
return NO;
}
So far this macro seems to do the trick without any issues.
#define IS_IPAD_PRO (MAX([[UIScreen mainScreen]bounds].size.width,[[UIScreen mainScreen] bounds].size.height) > 1024)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With