Get screen size
Get screen size
- Subject: Get screen size
- From: Bertrand Mansion <email@hidden>
- Date: Mon, 14 Jan 2002 11:03:28 +0100
Hi all,
I am trying to retrieve the size of my screen. Here is the code I use:
-(void)awakeFromNib
{
NSDictionary *screenDescription;
NSSize screenSize;
screenDescription = [self deviceDescription]; // I am in a NSWindow
subclass
screenSize = [[screenDescription objectForKey:@"NSDeviceSize"]
sizeValue];
NSLog(@"Height, Width is %d, %d", screenSize.height, screenSize.width);
}
This returns :
2002-01-14 10:51:54.182 WindowSize[413] Height, Width is 1081597952, 0
As these figures are strange, I guess there is something I am doing wrong. I
feel a bit confused about the description of NSDeviceSize. It is said in TFM
that it is an NSValue containing an NSSize and stored into an NSDictionary
(screenDescription here). I have no idea how to retrieve the width and
height it returns. Could you please help ?
Thank you,
Bertrand Mansion
PS : Thanks Lance for the tip on window title, it helped a lot.