Using Windows to Present Content on Multiple Displays

Every iOS app has a window that handles the presentation of the app’s user interface. Although the window provides crucial functionality, most apps never need to access it. Typically, only an app that supports an external display needs to interact with a window.

At a Glance

In iOS, the window object contains an app’s views and manages their presentation on the device display. The window’s associated screen object represents the specific device display currently in use. If your app allows users to view content on an external display, you create another window object to manage the presentation of content on that display.

Windows Provide Important Functionality to Your App

In addition to containing your app’s visible content, windows are involved in delivering touch events to your views and responding to orientation changes. A window’s associated screen object provides information about the device display currently being used. When you use storyboards to define your app’s user interface, the main storyboard automatically sets up the window that manages content display on the device.

An Additional Window Is Needed to Support an External Display

If your app supports an external device display, you need to create a separate window object to represent the content to display on it. You can show the same content on both displays—this feature is called mirroring and it happens by default—or you can show different content on each display.

See Also

App Programming Guide for iOS describes the fundamental architecture of an iOS app and provides coding guidelines and best practices that help your develop great apps.

AirPlay Overview describes how to provide AirPlay-compatible media to iOS-based devices.

UIWindow Class Reference describes the programming interfaces of the UIWindow class.

UIScreen Class Reference describes the programming interfaces of the UIScreen class.