IPad Dispatch Directive

I declare some constants in the header file, which should be different depending on whether it is an iPad or iPhone. How should I do it?

i.e.

#ifdef ISIPAD
static NSString myconst = @"ipad!";
#else
static NSString myconst = @"iphone!";
#endif
+3
source share
1 answer

If you are writing a universal application, you cannot perform a compile-time check because the compiler generates one executable file for the iPhone and iPad. If you have separate applications for iPhone and iPad (with a common code base), why not just #define ISIPAD accordingly. Otherwise, you must perform a run-time check.

, , , , , .

+7

Source: https://habr.com/ru/post/1765978/


All Articles