views:

46

answers:

2

hello all,

in my universal app i need to check in the ViewDidLoad if the iDevices is iPad or iPhone is there an method or code ?

thanks

A: 

check if UISplitViewController class available on the platform, if so make sure it is iPad using Apple's macro (notice that UIUserInterfaceIdiomPad constant is available only on iOS 3.2 and up).

if (NSClassFromString(@"UISplitViewController") != nil && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        //currentDeviceType = iPad;
    }
    else {
        //currentDeviceType = iPhone;
    }
Nimrod Gat