Skip to content

Instantly share code, notes, and snippets.

@nevyn
Created March 14, 2015 03:39
Show Gist options
  • Save nevyn/822cd8a9ad28f1fbe540 to your computer and use it in GitHub Desktop.
Save nevyn/822cd8a9ad28f1fbe540 to your computer and use it in GitHub Desktop.
//
// 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
//
// 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