Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS app which runs on two screen (no mirroring)

Tags:

ios

airplay

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.

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)

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?

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.

like image 343
Fréderic Cox Avatar asked Nov 01 '11 23:11

Fréderic Cox


People also ask

What do I do if my iPhone doesn't have screen mirroring?

Try these steps first:Check the AirPlay-compatible devices are turned on and near each other. Check that the devices are updated to the latest software and are on the same Wi-Fi network. Try restarting the devices. That is to be used with AirPlay or screen mirroring.

Can you use iPhone as second monitor?

With the appropriate cable or adapter, you can connect your iPhone to a secondary display, like a computer monitor, TV, or projector. Plug a Lightning Digital AV Adapter or Lightning to VGA Adapter into the charging port on the bottom of iPhone. Connect an HDMI or VGA cable to your adapter.


1 Answers

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!

AMENDED AFTER CLIFS COMMENT:

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]];
}
like image 139
Dev2rights Avatar answered Nov 15 '22 08:11

Dev2rights