Inherits From:
NSObject
Conforms To:
NSObject (NSObject)
Declared In:
AppKit/NSScreen.h
deepestScreen
method to find out which of the available screens can best represent color and then may choose to display all of its windows on that screen.
The two main attributes of a screen are its depth and its dimensions. The depth
method describes the screen depth (such as two-bit, eight-bit, or twelve-bit) and tells you if the screen can display color. The frame
method gives the screen's dimensions and location as an NSRect.
The device description dictionary contains more complete information about the screen. Use NSScreen's deviceDescription
method to access the dictionary, and use these keys to retrieve information about a screen:
Dictionary Key | Value |
---|---|
NSDeviceResolution | An NSValue that contains an NSSize which indicates the screen's resolution in dots per inch (dpi). |
NSDeviceColorSpaceName | The screen's color space name. See the NSGraphics class specification for a list of possible values. |
NSDeviceBitsPerSample | An NSNumber containing an integer that indicates the bit depth of screen images (2-bit, 8-bit, and so on). |
NSDeviceIsScreen | "YES" (a string), indicating the device is a screen. |
NSDeviceSize | An NSValue that contains an NSSize which indicates the screen's size in points. |
The device description dictionary contains information about not only screens, but all other system devices such as printers and windows. There are other keys into the dictionary that you would use to obtain information about these other devices. For a complete list of device dictionary keys, see NSGraphics.h.
The application object should be created before you use the methods in this class, so that the application object can make the necessary connection to the Window System. You can make sure the application object exists by invoking NSApplication's sharedApplication
method, which creates it if necessary. If you created your application with Project Builder, the application object is automatically created for you in main()
.
deepestScreen
Returns an NSScreen object representing the screen that can best represent color. This method always returns an object, even if there is only one screen and it is not a color screen.
mainScreen
Returns an NSScreen object representing the main screen. The main screen is the screen with the key window.
screens
Returns an array of NSScreen objects representing all of the screens available on the system. Raises NSWindowServerCommunicationException if the screens information can't be obtained from the window system.
depth
Returns the screen's depth, including whether the screen can display color.
deviceDescription
Returns the device dictionary as described in the class description.
frame
Returns the dimensions and location of the screen in an NSRect.
supportedWindowDepths
Returns a zero-terminated array of the window depths supported by the screen.
visibleFrame
Returns the dimensions and location of the visible screen in an NSRect. The frame for the visible screen is adjusted according to the interface style. For example, on the Macintosh, the visible screen area does not include the menu bar.