I am sure that this probably something extremely easy (or it can’t be done), but I can’t seem to find anything on it.
In one of my classes .h file I need to determine if the app is running on an iPad or an iPhone. Then change the value of the #define accordingly.
Ideally I would this it would look something like this:
#if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone
#define deltaX 10.0
#define theda 15.0
#define threshHold 267.0
#endif
#if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
#define deltaX 78.1
#define theda 67.2
#define threshHold 453.0
#endif
I am not sure what to use, any help would be very much appreciated.
Thank you for your time!
Sadly, you can’t do this, as in a universal app the same code runs on iPhone as on iPad, so this decision must be made at run-time, not compile-time.
You should declare these variables in a header file, and then set them at run time depending on the value of
UI_USER_INTERFACE_IDIOM().