在两个屏幕上运行的iOS应用程序(无镜像) [英] iOS app which runs on two screen (no mirroring)

查看:131
本文介绍了在两个屏幕上运行的iOS应用程序(无镜像)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含幻灯片的iPad应用,当用户点击此幻灯片时,他/她可以输入一些信息。

I've created an iPad app which contains a slideshow and when this slideshow is tapped by the user he/she can entered some information.

我是什么现在喜欢做的是在通过AirPlay连接电视和iPad时在电视上显示幻灯片内容(如果可能的话,还是有线电视,但这似乎只是反映了事情)

What I'd like to do now is to display the slideshow contents on a TV when connecting the TV and iPad through AirPlay (or cable if possible, but that only seems to mirror things)

可以这样做吗?我们是否可以在电视和iPad上播放幻灯片,然后当用户点击iPad上的幻灯片时,凭据输入屏幕将显示但在电视上仍会显示基础幻灯片而不显示凭据?

Can this be done? Can we have the slideshow run on the TV and also on iPad and then when the user taps the slideshow on the iPad the credentials input screen will show but on TV still the underlying slideshow will show and not the credentials?

如何在iOS中完成?是否可以在电视上显示部分应用程序?因此,不要镜像整个应用程序。

How can this be done in iOS? Is it possible to display a portion of the application on the TV? So not mirroring the entire application.

推荐答案

您可以使用Airplay和Apple TV编写应用程序以处理2个UIScreens然后设置适用于电视UIScreen和iPad UIScreen的独立根视图控制器。然后在电视的视图控制器上显示图像或幻灯片,并从iPad视图控制器的事件中运行该图像或幻灯片!

You can write the app to handle 2 UIScreens using Airplay and an Apple TV then set a seperate root view controller for both the TV UIScreen and for the iPad UIScreen. Then display the image or slideshow on the TV's view controller and run that from the events of you iPads view controller!

在CLIFS评论之后修改:

AMENDED AFTER CLIFS COMMENT:

首先在你的appfactishLaunchingWithOptions或didFinishLaunching中设置一个通知来接收屏幕确实已连接。

So firstly in your app delegate in didFinishLaunchingWithOptions or didFinishLaunching setup a notification to receive the screen did connect.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidConnect:) name:UIScreenDidConnectNotification object:nil];

然后您需要保持对单独窗口的引用并将控制器推送到其他任何其他窗口窗口。

Then you need to keep a reference to your separate window and push controllers to it as you would any other window.

- (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应用程序(无镜像)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆