Yes, it is possible, but it probably does not do what you think. Preprocessor directives are interpreted before the results of the preprocessing stage are compiled.
This means that all preprocessor directives are interpreted by overriding some macros before the rest of the code is compiled, which will look something like this.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { } else { }
In other words, after preprocessing, you just have the if and else tags.
If you want to change the value of something based on a condition at runtime, then something must be a genuine object, not just a preprocessor macro. For instance.
extern int TableViewHeight; // defined somewhere else extern int DisplayHeight; // defined somewhere else extern int DisplayWidth; // defined somewhere else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { TableViewHeight = 916; DisplayHeight = 1024; DisplayWidth = 768; } else { TableViewHeight = 374; DisplayHeight = 480; DisplayWidth = 320; }
source share