Skip to content

Instantly share code, notes, and snippets.

@perlguy99
Created March 7, 2018 15:03
Show Gist options
  • Save perlguy99/18ef9508acd931507915891e5038a106 to your computer and use it in GitHub Desktop.
Save perlguy99/18ef9508acd931507915891e5038a106 to your computer and use it in GitHub Desktop.
Device Orientation Macros
#define SCREEN_WIDTH ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height)
#define SCREEN_HEIGHT ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.height : [[UIScreen mainScreen] bounds].size.width)
@perlguy99
Copy link
Author

Validate before using. Didn't seem to work while I tested the width in the debugger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment