One Quickie


Are we compiling for the device, simulator, or other? (Building->General)
// Are we compiling for the device, simulator, or desktop?
#if TARGET_OS_IPHONE && TARGET_IPHONE_SIMULATOR
#define GR_TARGET_SIMULATOR 1

#elif TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
#define GR_TARGET_DEVICE 1

#else
#define GR_TARGET_DESKTOP 1

#endif
Then I use the GR_TARGET symbols for #if'ing in platform-specific chunklets of code.



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com