picture home | pixelblog | qt_tools

omino code blog

We need code. Lots of code.
/\/\/\/\/\/\
David Van Brink // Sun 2013.12.29 10:14 // {code ios}

iOS: Multiple Screens Oddity

Presently working on a little iOS app for some theatre related work. Wanted to display some information on a secondary screen. The iPhone supports this nicely, with either an HDMI adapter, or a composite video adapter, or AirPlay to an Apple TV.

Apple has an example project which shows this, and works well: https://developer.apple.com/library/ios/samplecode/ExternalDisplay/Listings/ReadMe_txt.html

Gotcha Number One
On my iPhone, the sample app works fine. I can enable and disable AirPlay, or plug and unplug the HDMI adapter, and the app rolls with it. But on iOS Simulator 7.0, using the Hardware:TV Out menu to do that virtually (TV Out disabled/enabled) causes the app to crash. So no testing there!

Gotcha Number Two
What is rarely mentioned, and I’ve only discerned by innuendo, is that your AppDelegate must expose a property for each UIWindow you create. The default generated AppDelegate always includes .window. And if you use a Storyboard Nib, then it’s all magicked for you.

So anyway, you need to have this in your AppDelegate.h:

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIWindow *secondWindow;

The example project calls the second one extWindow.
And the idea is mentioned, in passing, in this apple note.

An iOS developer offers some tips (but not this one!) at this entry.

So many secrets!

oh, i dont know. what do you think?



(c) 2003-2011 omino.com / contact poly@omino.com