iOS Developer Library

Developer

UIKit Framework Reference UIScreenMode Class Reference

Options
Deployment Target:

On This Page
Language:

UIScreenMode

A UIScreenMode object represents a possible set of attributes that can be applied to a UIScreen object. The object encapsulates information about the size of the screen’s underlying display buffer and the aspect ratio it uses for individual pixels.

Most developers should never need to use the information provided by this class and should simply use the bounds provided by the UIScreen object for their drawing space. The bounds of screen and window objects automatically take the pixel aspect ratio and underlying drawing hardware into consideration. However, developers that work with pixel-level information more directly may use the information in the current screen mode object to tailor their code for the target screen.

You do not create instances of this class directly. Instead, you get the screen modes supported by a given screen from the corresponding UIScreen object.

Inheritance


Conforms To


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 3.2 and later.
  • size size Property

    The screen size, measured in pixels. (read-only)

    Declaration

    Swift

    var size: CGSize { get }

    Objective-C

    @property(readonly, nonatomic) CGSize size

    Discussion

    The value in this property represents the size of the underlying display buffer.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.2 and later.

  • The aspect ratio of a single pixel. (read-only)

    Declaration

    Swift

    var pixelAspectRatio: CGFloat { get }

    Objective-C

    @property(readonly, nonatomic) CGFloat pixelAspectRatio

    Discussion

    The aspect ratio is defined as x/y, where x is the width of the pixel and y is the height of the pixel.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.2 and later.