我已经为iPhone创建了一个应用程序,对于4S我想通过AirPlay支持应用程序的屏幕镜像.
使用System AirPlay选择器并启用镜像,它将镜像应用程序而不会出现任何问题.
我想在应用程序中提供此选择器并使用以下基本代码:
MPVolumeView *volumeView = [ [MPVolumeView alloc] init] ;
[volumeView setShowsVolumeSlider:NO];
[volumeView sizeToFit];
[self.view addSubview:volumeView];
Run Code Online (Sandbox Code Playgroud)
这提供了一个AirPlay选择器,我可以选择Apple TV.但它并不反映AirPlay上的内容.当我进入系统选择器时,它显示已选择AppleTV,并且为了启用镜像,我必须在此处使用开关.
所以问题是,当用户使用应用程序选择器选择AirPlay时,如何在应用程序中启用镜像?
谢谢
我正试图在没有镜像模式的情况下使用Airplay在Apple TV上显示图片.但是,当镜像关闭时,[UIScreen screen]方法总是返回1个屏幕(主屏幕).我希望我的图片显示与Photo应用程序相同(没有镜像的Airplay).
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidConnect:) name:UIScreenDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidDisconnect:) name:UIScreenDidDisconnectNotification object:nil];
Run Code Online (Sandbox Code Playgroud)
我使用过它们,但只有在镜像开启时才能使用它们.
请帮我.非常感谢!我正在使用Apple TV1和iPad 2(iOS 5.0.1)