Last active
December 10, 2015 00:28
-
-
Save muromec/4351189 to your computer and use it in GitHub Desktop.
bunch of magic macros to handle cross-device objc code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef TEXR_CROSS_H | |
#define TEXR_CROSS_H | |
#if TARGET_OS_IPHONE | |
#define IPHONE 1 | |
#else | |
#define IPHONE 0 | |
#endif | |
#define on_iphone(x) {} | |
#define on_mac(x) {} | |
#define on_ios(x) {} | |
#define on_ipad(x) {} | |
#if IPHONE | |
#undef on_iphone | |
#undef on_ios | |
#undef on_ipad | |
#define on_iphone(x) if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {x} | |
#define on_ipad(x) if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {x} | |
#define on_ios(x) {x} | |
#define on_wide(x) if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {x} | |
#else | |
#undef on_mac | |
#define on_mac(x) {x} | |
#define on_wide(x) {x} | |
#endif | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment