Is there a build preprocessor macro I can check, with #if
or #ifdef
to determine if my current Xcode project is being built for iPhone or iPad?
I use the following code for AppleTV 4 because UIUserInterfaceIdiomUnspecified, doesn't seem to work, nor can I find any other enums:
#ifdef TARGET_OS_IOS
CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.width == 1920) {
NSLog(@"tvOS");
}
#endif
I used to use this for iPad and such before the dark times, before the empire- OB1, hah good night. But you can use this similar technique for other screen sizes you know of.