Multidevice programming

Posted by Daniel Vela on July 25, 2011

xcode icon

To create a project from another project iPad iPhone, Xcode have a choice in a popover that lets you:

  • Create a universal project for iPhone and iPhone.
  • Create two different targets, one for iPhone and another iPhone

UI Idiom

UIDevice.h
typedef enum {
UIUserInterfaceIdiomPhone,
UIUserInterfaceIdiomPad
} UIUserInterfaceIdiom;

#define UI_USER_INTERFACE_IDIOM()...

// Sample code
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
... // iPad code
} else {
... // iPhone code
}

20110324.14