Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
NSScreen+HighestDensity.h
#import <Cocoa/Cocoa.h>
@interface NSScreen (HighestDensity)
+ (CGFloat)highestDensity;
@end
#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
#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
Something went wrong with that request. Please try again.