If you mean get the Display screen resolutions.
This may be what you are after.
NSScreen* thescreen;
id theScreens = [NSScreen screens];
for (thescreen in theScreens) {
NSLog(@"%@x%@", [NSNumber numberWithFloat:[thescreen frame].size.width], [NSNumber numberWithFloat:[thescreen frame].size.height]);
}
This example will give you the set resolutions of all displays
Have a look at apples NSScreen
If this is not quite what you are after can you expand your question.
Cheers
- UPDATE. in regard to comment from OP on wanting all possible display resolutions.
This maybe what you are after and you will have to play with it to see if it is indeed returning the correct info. I was getting multiple results hence the filter. But if you play with it you should be able to thin it down.
The test project was using ARC and it forced the __bridges.. But again I am sure you will have time to code it all better.
My reference was Quartz Display Services Reference
NSArray* theref = (__bridge NSArray *)(CGDisplayCopyAllDisplayModes ( CGMainDisplayID(), nil ));
NSMutableArray * rezes = [[NSMutableArray alloc]init];
for (id aMode in theref) {
CGDisplayModeRef thisMode = (__bridge CGDisplayModeRef)(aMode);
size_t theWidth = CGDisplayModeGetWidth( thisMode );
size_t theHeight = CGDisplayModeGetHeight( thisMode );
NSString *theRez = [NSString stringWithFormat:@"%zux%zu",theWidth,theHeight];
if (![rezes containsObject:theRez]) {
[rezes addObject:theRez];
}
}
NSLog(@" display deatails = %@", rezes);
-->
display deatails = (
2560x1440,
1280x720,
640x480,
800x600,
1024x768,
1280x1024,
1344x756,
1600x900,
1680x1050,
1920x1080,
1600x1200,
1920x1200
)