Created
April 22, 2015 11:26
-
-
Save ZhukV/4d621bb0332770aa6a8a to your computer and use it in GitHub Desktop.
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
#import "UIScreen+ScreenBounds.h" | |
@implementation UIScreen (ScreenBounds) | |
+ (CGRect)screenBounds | |
{ | |
CGRect screenBounds = [UIScreen mainScreen].bounds; | |
if(NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1){ | |
return screenBounds; | |
} | |
CGFloat width = CGRectGetWidth(screenBounds); | |
CGFloat height = CGRectGetHeight(screenBounds); | |
UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation; | |
if(UIInterfaceOrientationIsPortrait(interfaceOrientation)){ | |
screenBounds.size = CGSizeMake(width, height); | |
}else if(UIInterfaceOrientationIsLandscape(interfaceOrientation)){ | |
screenBounds.size = CGSizeMake(height, width); | |
} | |
return screenBounds; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment