Class: UIScreen

NSObject show all


A UIScreen object contains the bounding rectangle of the device’s entire screen. When setting up your application’s user interface, you should use the properties of this object to get the recommended frame rectangles for your application’s window.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (CGRect) applicationFrame (readonly)

The frame rectangle to use for your application’s window. (read-only) This property contains the screen bounds minus the area occupied by the status bar, if it is visible. Using this property is the recommended way to retrieve your application’s initial window size. The rectangle is specified in points.


- (Array) availableModes (readonly)

The display modes that can be associated with the receiver. (read-only) The array contains one or more UIScreenMode objects, each of which represents a display mode supported by the screen.


- (CGRect) bounds (readonly)

Contains the bounding rectangle of the screen, measured in points. (read-only)


- (Float) brightness

The brightness level of the screen. This property is only supported on the main screen. The value of this property should be a number between 0.0 and 1.0, inclusive.


- (UIScreenMode) currentMode

The current screen mode associated with the receiver. The default value of this property is the mode containing the highest resolution supported by the screen. You can change the value of this property to support different resolutions as needed. For example, you might want to lower the default resolution to one that your application supports more readily.


- (UIScreen) mirroredScreen (readonly)

The screen being mirrored by an external display. (read-only) If mirroring is supported and currently active, this property contains the screen object associated with the device’s main screen. This represents the screen being mirrored by the attached display. The value of this property is nil when mirroring is disabled, not supported, or no screen is connected to the device. To disable mirroring and use the external display for presenting unique content, create a window and associate it with the corresponding screen object.


- (UIScreenOverscanCompensation) overscanCompensation

For an external screen, this property sets the desired technique to compensate for overscan. Some external displays may be unable to reliably display all of the pixels to the user. To compensate, choose one of the techniques described in “UIScreenOverscanCompensation”.

- (UIScreenMode) preferredMode (readonly)

The preferred display mode for the receiver. (read-only)


- (Float) scale (readonly)

The natural scale factor associated with the screen. (read-only) This value reflects the scale factor needed to convert from the default logical coordinate space into the device coordinate space of this screen. The default logical coordinate space is measured using points, where one point is approximately equal to 1/160th of an inch. If a device’s screen has a reasonably similar pixel density, the scale factor is typically set to 1.0 so that one point maps to one pixel. However, a screen with a significantly different pixel density may set this property to a higher value.


- (Boolean) wantsSoftwareDimming

A Boolean value that indicates whether the screen may be dimmed lower than the hardware is normally capable of by emulating it in software. The default value is NO. Enabling it may cause a loss in performance.


  • (Boolean)

Class Method Details

+ (UIScreen) mainScreen

Returns the screen object representing the device’s screen.


  • (UIScreen)

    The screen object for the device

+ (Array) screens

Returns an array containing all of the screens attached to the device. The returned array includes the main screen plus any additional screens connected to the device. The main screen is always at index 0.Not all devices support external displays. Currently, external displays are supported by iPhone and iPod touch devices with Retina displays and iPad. Older devices, such as the iPhone 3GS do not support external displays. Connecting to an external display requires an appropriate cable between the device and display.


Instance Method Details

- (CADisplayLink) displayLinkWithTarget(target, selector:sel)

Returns a display link object for the current screen. You use display link objects to synchronize your drawing code to the screen’s refresh rate. The newly constructed display link retains the target.


  • target (Object)

    An object to be notified when the screen should be updated.

  • sel (Symbol)

    The method of target to call. This selector must have the following signature:- (void)selector:(CADisplayLink *)sender;