preprocessor - Using #define to determine ios device type -


i'm figuring out how determine ios device types , came across solution: https://stackoverflow.com/a/16319767/440646

the line of question:
#define is_ipad (ui_user_interface_idiom() == uiuserinterfaceidiompad)

i read #define preprocessor evaluated before compilation, ui_user_interface_idiom() statement.

my question how compiler knows device compile for, since we'll know device user using during runtime?

#define is_ipad (ui_user_interface_idiom() == uiuserinterfaceidiompad) not check specific device (iphone 4, iphone 5, etc) device category (iphone, ipad).

here question shows macro does. understand: is safe check ui_user_interface_idiom() determine if it's iphone or ipad?


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -