Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if iPad is iPad Pro

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
    }
like image 800
Francis F Avatar asked Nov 20 '15 06:11

Francis F


3 Answers

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");
  }
like image 177
Leo Avatar answered Nov 04 '22 12:11

Leo


+(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;
}
like image 31
pankaj raghav Avatar answered Nov 04 '22 11:11

pankaj raghav


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)
like image 26
Francis F Avatar answered Nov 04 '22 13:11

Francis F