Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: AppKit/NSScreen.h
An NSScreen object describes the attributes of a computer's monitor, or screen. An application may use an NSScreen object to retrieve information about a screen and use this information to decide what to display upon that screen. For example, an application may use the 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()
.
- Getting NSScreens
- + mainScreen
- + deepestScreen
- + screens
- Reading screen information
- - depth
- - frame
- - supportedWindowDepths
- - deviceDescription
- - visibleFrame
+ (NSScreen *)deepestScreen
+ (NSScreen *)mainScreen
+ (NSArray *)screens
- (NSWindowDepth)depth
- (NSDictionary *)deviceDescription
- (NSRect)frame
- (const NSWindowDepth *)supportedWindowDepths
- (NSRect)visibleFrame