Brad's solution is absolutely correct. If you are creating a universal application designed to work on iPhone with an older OS, as well as with modern iPads and iPhones, you might want to add this code to catch situations where the idiom is not defined.
#ifndef __IPHONE_3_2
typedef enum {
UIUserInterfaceIdiomPhone,
UIUserInterfaceIdiomPad,
} UIUserInterfaceIdiom;
#define UI_USER_INTERFACE_IDIOM() UIUserInterfaceIdiomPhone
#endif
source
share