Last active
August 29, 2015 14:06
-
-
Save sdpjswl/e250cc148af4faed746e to your computer and use it in GitHub Desktop.
Get screen size depending on device orientation
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
// | |
// UIApplication+AppDimensions.m | |
// GolfByJordan | |
// | |
// Created by sudeep on 26/08/14. | |
// Copyright (c) 2014 Esense. All rights reserved. | |
// | |
#import "UIApplication+AppDimensions.h" | |
@implementation UIApplication (AppDimensions) | |
+(CGSize)currentSize; | |
@end |
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
// | |
// UIApplication+AppDimensions.m | |
// GolfByJordan | |
// | |
// Created by sudeep on 26/08/14. | |
// Copyright (c) 2014 Esense. All rights reserved. | |
// | |
#import "UIApplication+AppDimensions.h" | |
@implementation UIApplication (AppDimensions) | |
+(CGSize) currentSize { | |
return [UIApplication sizeInOrientation:[UIApplication sharedApplication].statusBarOrientation]; | |
} | |
+(CGSize) sizeInOrientation:(UIInterfaceOrientation)orientation { | |
CGSize size = [UIScreen mainScreen].bounds.size; | |
if (UIInterfaceOrientationIsLandscape(orientation)) { | |
CGFloat version = [[[UIDevice currentDevice] systemVersion] floatValue]; | |
if (version < 8.0) { | |
size = CGSizeMake(size.height, size.width); | |
} | |
else { | |
size = CGSizeMake(size.width, size.height); | |
} | |
} | |
return size; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment