0

Can I do something as simple as:

myHeaderFile~iphone.h

myHeaderFile~iPad.h

and then: #import "myHeaderFile.h"

?

I'm assuming no, but you get the idea. Any tips?

If I try using macros it doesn't work, because by the time the macros are parsed, the app is already running. I just need that for loading different definitions for different screen resolutions.

hcabral
  • 343
  • 1
  • 3
  • 8
  • Check this link : http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk – Anupam Apr 19 '13 at 19:18

1 Answers1

1

How about something like this instead?

#ifdef UI_USER_INTERFACE_IDIOM()
  #define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#else
  #define IS_IPAD() (false)
#endif

Then you can selectively build code like:

if (IS_IPAD()){
// do something for iPad
}
else {
// do something for iPhone/iPod
}
Macness
  • 1,226
  • 2
  • 13
  • 24
  • Macness, I've done it before, the thing is that for a staged game, that becomes the rule, not the exception. I've achieved this before following this strategy, and by using properties in a helper class instead of macros. IMO, using macros in header files would do a better job to keep my code organized. – hcabral Apr 22 '13 at 18:56