I'm creating iPhone app for kids which they can play with alphabets and numbers.
I want to providing the option for airplay so that playing on bigger screen will be more fun.

I'm using the following code to show the airplay button:

MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 105, 40)];
[bottomPanel addSubview:volumeView];

I'm able to see the volume view, but not the airplay button. Can some one help me how to show the airplay button for my app?

有帮助吗?

解决方案

Your code fragment should show the AirPlay button, if run on a device, and with AirPlay devices on your local network.

It worked for me, in an otherwise empty test application. When I switched Wi-Fi off (and therefore there were no AirPlay devices), the button disappeared.

As for interacting with external screens, have a look at the UIScreen class, and the AirPlay and External Displays in iOS apps session from the 2011 WWDC. However, as @Till mentions, your users may have to enable screen mirroring from the UI in the multi-tasking bar.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top