Created
March 14, 2015 03:39
-
-
Save nevyn/822cd8a9ad28f1fbe540 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// | |
// UIScreen+UIScreen_GFNaturalSize.h | |
// LookBack | |
// | |
// Created by Nevyn Bengtsson on 2015-03-13. | |
// Copyright (c) 2015 Lookback. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIScreen (GFNaturalSize) | |
// Returns the size of the screen without orientation transforms, in points, under both iOS 7 and 8 | |
- (CGSize)gf_naturalSize; | |
@end |
This file contains hidden or 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
// | |
// UIScreen+UIScreen_GFNaturalSize.m | |
// LookBack | |
// | |
// Created by Nevyn Bengtsson on 2015-03-13. | |
// Copyright (c) 2015 Lookback. All rights reserved. | |
// | |
#import "UIScreen+GFNaturalSize.h" | |
@implementation UIScreen (GFNaturalSize) | |
- (CGSize)gf_naturalSize; | |
{ | |
CGSize screenSizeInPoints = self.bounds.size; | |
if([self respondsToSelector:@selector(nativeBounds)]) { | |
screenSizeInPoints = CGSizeMake( | |
self.nativeBounds.size.width / self.nativeScale, | |
self.nativeBounds.size.height / self.nativeScale | |
); | |
} | |
return screenSizeInPoints; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment