Search code examples
iosiphoneipad

Checking if device is iPad


What is wrong with this code? I want to be able to check if the current device the user is using is an iPad but it keeps giving me errors.

if (UIUserInterfaceIdiom == UIUserInterfaceIdiomPad)
{
    //do stuff
}

Solution

  • You can use

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)