Is there a build preprocessor macro I can check, with #if
or #ifdef
to determine if my current Xcode project is being built for iPhone or iPad?
EDIT
As several answers have pointed out, often apps are universal, and the same binary can run on both devices. Conditional behavior between these very similar devices should be solved at runtime rather than compile time.
Some ideas in the comment section of this blog
http://greensopinion.blogspot.com/2010/04/from-iphone-to-ipad-creating-universal.html
Mostly using
UI_USER_INTERFACE_IDIOM()
Such as:
#ifdef UI_USER_INTERFACE_IDIOM()
#define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#else
#define IS_IPAD() (false)
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With