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:
- I can get the secondary UIScreen object easily, either from
UIScreenDidConnectNotification
or[UIScreen screens]
, but as far as I know UIScreens don't have references to the UIWindow being shown. - Since we're just using the display that AirPlay auto-generates, I can't save a reference to the UIWindow during its creation.
- I've checked
[[UIApplication sharedApplication] windows]
, and it doesn't seem to include the UIWindow associated with the external display. (At least, none of thewindow.screen
objects match the UIScreen object I get fromUIScreenDidConnectNotification
when the TV first connects, and while[[UIScreen screens] count]
goes up by 1 when a TV is connected, the count of windows remains static.)
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?