Apple advises using the following code to detect whether running on an iPad or iPhone/iPod Touch:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
Instead of any compiler based stuff I use:
- (BOOL)deviceIsAnIPad {
if ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)])
//We can test if it's an iPad. Running iOS3.2+
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
return YES; //is an iPad
else
return NO; //is an iPhone
else
return NO; //does not respond to selector, therefore must be < iOS3.2, therefore is an iPhone
}