ios5xcode4.2ipad-3

ipad: how can i detect ipad3 for in my application?


i am working in an app in which i have images , now the problem is that ipad3 has retina display is there any method in ios5 by which i can identify whether the device is ipad3 or ipad2.I want my app to be worked in both the devices.Is there any solution for this


Solution

  • Can't you just use the @2x suffix?

    Eg, you have image fancyBackground.png for regular ipad, and fancyBackground@2x.png for retina display?

    When you do this, it will automatically use the correct image for the type of display that the device has (retina devices will use @2x-suffixed image files if they exist).

    You can detect if a device is iPad by using:

    UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
    

    You can detect if a device is retina by using:

    [[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] >= 2.0