• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Get screen size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Get screen size
      • From: Sam Goldman <email@hidden>
  • Prev by Date: RE: cocoa-dev digest, Vol 2 #12 - 2 msgs
  • Next by Date: Re: Get screen size
  • Previous by thread: Re: Setting global umask
  • Next by thread: Re: Get screen size
  • Index(es):
    • Date
    • Thread