Created
September 3, 2012 12:54
-
-
Save sangregoriopaolo/3609137 to your computer and use it in GitHub Desktop.
NSScreen+HighestDensity.h
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 <Cocoa/Cocoa.h> | |
@interface NSScreen (HighestDensity) | |
+ (CGFloat)highestDensity; | |
@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
#import "NSScreen+HighestDensity.h" | |
@implementation NSScreen (HighestDensity) | |
+ (CGFloat)highestDensity { | |
// Support for OSX 10.6 | |
if (![[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) return 1.0f; | |
NSArray *screens = [NSScreen screens]; | |
CGFloat highestDensity = 1.0f; | |
for (NSScreen *screen in screens) { | |
if ([screen backingScaleFactor] > highestDensity) { | |
highestDensity = [screen backingScaleFactor]; | |
} | |
} | |
return highestDensity; | |
} | |
@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
#import "NSScreen+HighestDensity.h" | |
@implementation NSScreen (HighestDensity) | |
+ (CGFloat)highestDensity { | |
// Support for OSX 10.6 | |
if (![[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) return 1.0f; | |
NSArray *screens = [NSScreen screens]; | |
CGFloat highestDensity = 1.0f; | |
for (NSScreen *screen in screens) { | |
if ([screen backingScaleFactor] > highestDensity) { | |
highestDensity = [screen backingScaleFactor]; | |
} | |
} | |
return highestDensity; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment