Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
AirPlay

I just tried your app, but didn't see any way to enable AirPlay. If the only way to do that is via AirPlay Mirroring, then that's not a very good example of what we're talking about here. And in the case of your game, the answer card would be made visible for everyone to see on the TV. Or am I doing something wrong?

First, sorry I didn't see this reply until now.

Second, yes, you have to enable AirPlay mirroring via the OS. It's sort of weird they way it works, but that's the only way Apple lets us access the second display. Once you enable AirPlay Mirroring, the app can see the second display and can put different content on it, (even though it's called Mirroring). So when you play the game, the AirPlay display will not show the answer card to everyone, in fact the entire display is laid out differently since there's also no need to have the drawing controls on the second display etc.

Hope you like the game.
 
Second, yes, you have to enable AirPlay mirroring via the OS. It's sort of weird they way it works, but that's the only way Apple lets us access the second display. Once you enable AirPlay Mirroring, the app can see the second display and can put different content on it, (even though it's called Mirroring). So when you play the game, the AirPlay display will not show the answer card to everyone, in fact the entire display is laid out differently since there's also no need to have the drawing controls on the second display etc.
Wow, that's definitely a screw-up on Apple's part then. They've touted a couple of these AirPlay-enabled games in their keynotes, but they're requiring us to turn on AirPlay *Mirroring* via the OS, which is of course unintuitive since, in the case of an app that's trying to do something creative and display *different* content on the TV, it's not going to *mirror* the display. Hopefully Apple will correct this soon and let you add an AirPlay button directly to your app's UI.
 
Wow, that's definitely a screw-up on Apple's part then. They've touted a couple of these AirPlay-enabled games in their keynotes, but they're requiring us to turn on AirPlay *Mirroring* via the OS, which is of course unintuitive since, in the case of an app that's trying to do something creative and display *different* content on the TV, it's not going to *mirror* the display. Hopefully Apple will correct this soon and let you add an AirPlay button directly to your app's UI.

It's definitely confusing the way they do it. I filed a bug report on it, since I thought I was actually coding it wrong, for the exact reason, I didn't want to Mirror the display.

It sucks for devs that it's so confusing, I've had bad reviews from people who expected the app to auto enable AirPlay for example. But it's just not possible for us to do it any other way.
 
Sorry this reply is a bit outdated, just realized I had some macrumors forums notifications.

This has been possible and actually quite easy to do with Cocoa for a long time. First you check whether [UIScreen screens].count >= 2. There is always one screen, but if this count is 2 or more then you have an external screen.

My understanding is that count doesn't increment until a second screen is actually connected. If you use a cable this happens right away, but if you are on an airplay network and your device supports mirroring the only way to turn that on is in the multitasking bar. That latter part is what I was referring to when I said "This" but I probably wasn't clear enough.

If you know of an App Store approved way of turning on mirroring from within an app I'd be very keen to hear how.

Next you get the second screen, that's [[UIScreen screens]objectAtIndex:1]. Get its bounds by calling the bounds method, create a window, set it to be on the second screen, add a view, and that's it. That's all to get started.

If you want to do it really well, you can ask iOS to tell you when external screens are added or removed, you can ask what resolutions are available and change the resolution if you want. But it's all really easy to do.

Designing a useful user interface may be a little problem, since your external screen won't be a touch screen; so if you put a button on the external display, nobody will be able to press it. Second display is purely for display.

I agree with this whole section, we do custom drawing in our game Tip of the Tongue and it really is best streaming to an Apple TV.

One thing we are especially proud of are the dynamic instructions that appear (iPad only, right now) depending on if an Apple TV is present. How it works:
  1. Apple TV available on current wifi: Tell user to double tap home button and turn on mirroring
    • After they do double-tap: change the instructions to show a graphic helping to find the mirroring icon (a bit of
      a hack, since there is no "multitasking bar showing" notification)
    • If they enable mirroring the TV display starts up and the mirroring specific instructions go away.
  2. No Apple TV, but device supports mirroring: Show hint on last page of instructions.
  3. Non-supported device: don't show instructions/tips.

I plan to open source our method as soon as time allows since I think educating people about mirroring will help everyone (I didn't know how to turn it on in my iPhone 4S until after I wrote the corresponding feature).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.