我现在要做的是在通过AirPlay连接电视和iPad时在电视上显示幻灯片显示内容(如果可能的话,还可以连接电缆,但这似乎只是镜像事物)
可以这样做吗?我们是否可以在电视和iPad上播放幻灯片,然后当用户点击iPad上的幻灯片时,凭据输入屏幕将显示但在电视上仍会显示基础幻灯片而不显示凭据?
如何在iOS中完成?是否可以在电视上显示部分应用程序?所以不要反映整个应用程序.
解决方法 您可以使用Airplay和Apple TV编写应用程序以处理2个UIScreens,然后为电视UIScreen和iPad UIScreen设置单独的根视图控制器.然后在电视的视图控制器上显示图像或幻灯片,并从iPad视图控制器的事件中运行该图像或幻灯片!CliFS评论后修改:
所以首先在你的应用委托中,在dIDFinishLaunchingWithOptions或dIDFinishLaunching设置一个通知,以接收屏幕确实连接.
[[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(screenDIDConnect:) name:UIScreenDIDConnectNotification object:nil];
然后,您需要保持对单独窗口的引用,并像其他任何窗口一样将控制器推送到它.
- (voID) myScreenInit:(UIScreen *)connectedScreen:(UIVIEwController*)mynewVIEwController{ //Intitialise TV Screen if(!windowTV) { CGRect frame = connectedScreen.bounds; windowTV = [[UIWindow alloc] initWithFrame:frame]; windowTV.backgroundcolor = [UIcolor clearcolor]; [windowTV setScreen:connectedScreen]; windowTV.hIDden = NO; } UIVIEwController* release = windowTV.rootVIEwController; windowTV.rootVIEwController = mynewVIEwController; [release removeFromParentVIEwController]; [release release];}- (voID)setTvController:(UIVIEwController*)mynewVIEwController{ UIVIEwController* release = windowTV.rootVIEwController; windowTV.rootVIEwController = mynewVIEwController; [release removeFromParentVIEwController]; [release release];}- (voID)screenDIDConnect:(NSNotification *)notification { [self myScreenInit:[notification object]];}总结
以上是内存溢出为你收集整理的在两个屏幕上运行的iOS应用程序(无镜像)全部内容,希望文章能够帮你解决在两个屏幕上运行的iOS应用程序(无镜像)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)