Search code examples
iphonexcodeipadipod

How to know the device?


I am developing a comic book using Cocoa Touch in Xcode.I dont know how to get the details of the device whether the device is iphone, ipad or ipod.

I am trying for an universal build.

How to identify the device? Is there a way to change the screen size according to the device?


Solution

  • You can use this for you first question -

       + (BOOL)isDeviceAniPad {
        #ifdef UI_USER_INTERFACE_IDIOM
            return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
        #else
            return NO;
        #endif
        }
    

    And for you second you don't need to change it your self the iphone/ipad will use use the views sizes that fits its screen. you will have to supply different images sizes or to scale them to the size of the screen.