Nerrolken
Nerrolken

Reputation: 2005

Get UIWindow of AirPlay mirroring screen

I'm trying to get the UIWindow object of the external screen (such as a television) when using AirPlay mirroring. The tricky part: it really is AirPlay mirroring, not a separate display, as we're using the built-in functionality of AirPlay rather than setting up a new UIWindow object and assigning it to the new screen. My boss wants the app to mirror the device in every way, but to be able to add subviews (tutorial overlays) to the external window exclusively, by adding them to the secondary screen's UIWindow.

What I've Tried:

Is there a way to access the window for a secondary screen using AirPlay mirroring? Or alternatively, is there a way to efficiently implement app-wide mirroring of the device, that allows greater control of the UIWindow object associated with the TV?

Upvotes: 2

Views: 886

Answers (1)

jcaron
jcaron

Reputation: 17720

This document from Apple: https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/UsingExternalDisplay/UsingExternalDisplay.html

states that:

To re-enable mirroring after displaying unique content, simply remove the window you created from the appropriate screen object.

This means that when mirroring is active, there is no window linked to it, and the mirroring just uses the window of the main screen.

There is only a single window, and I don't think it's possible to show different content in this mode.

If you want to show different content, you'll have to create a new window and assign it to that screen.

Upvotes: 4

Related Questions