Check If App Is Running On An iPad

Although you can use something like this – Get iPhone Device Name, Unique Device Identifier (UDID), OS and Model – to check if your app is running on an iPad, there is a much easier way.

Check the userInterfaceIdiom property of the device to get the information you need:

As noted in the comments below, Apple provides a macro to accomplish the same task. Here is the full definition from the UIDevice.h header file:

Thanks for the heads up on this.

  1. or just use this:

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) iPadDevice = YES;

    UI_USER_INTERFACE_IDIOM() is defined in UIDevice.h and performs the same checks
    (write UI_USER_INTERFACE_IDIOM() in your source and Cmd+Click on it to see)

  2. Why not just use

    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);

  3. There’s a macro for that: UI_USER_INTERFACE_IDIOM()

Comments are closed.